<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-comment">{-
(c) The University of Glasgow 2006
(c) The GRASP/AQUA Project, Glasgow University, 1992-1998


Monadery used in desugaring
-}</span><span>
</span><span id="line-8"></span><span>
</span><span id="line-9"></span><span class="hs-pragma">{-# LANGUAGE DeriveFunctor #-}</span><span>
</span><span id="line-10"></span><span class="hs-pragma">{-# LANGUAGE FlexibleContexts #-}</span><span>
</span><span id="line-11"></span><span class="hs-pragma">{-# LANGUAGE FlexibleInstances #-}</span><span>
</span><span id="line-12"></span><span class="hs-pragma">{-# LANGUAGE LambdaCase #-}</span><span>
</span><span id="line-13"></span><span class="hs-pragma">{-# LANGUAGE ViewPatterns #-}</span><span>
</span><span id="line-14"></span><span>
</span><span id="line-15"></span><span class="hs-pragma">{-# OPTIONS_GHC -fno-warn-orphans #-}</span><span>  </span><span class="hs-comment">-- instance MonadThings is necessarily an orphan</span><span>
</span><span id="line-16"></span><span>
</span><span id="line-17"></span><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">GHC.HsToCore.Monad</span><span> </span><span class="hs-special">(</span><span>
</span><span id="line-18"></span><span>        </span><span class="annot"><a href="GHC.Tc.Types.html#DsM"><span class="hs-identifier">DsM</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/Data.Traversable.html#mapM"><span class="hs-identifier">mapM</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/Control.Monad.html#mapAndUnzipM"><span class="hs-identifier">mapAndUnzipM</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-19"></span><span>        </span><span class="annot"><a href="GHC.HsToCore.Monad.html#initDs"><span class="hs-identifier">initDs</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.HsToCore.Monad.html#initDsTc"><span class="hs-identifier">initDsTc</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.HsToCore.Monad.html#initTcDsForSolver"><span class="hs-identifier">initTcDsForSolver</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.HsToCore.Monad.html#initDsWithModGuts"><span class="hs-identifier">initDsWithModGuts</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.HsToCore.Monad.html#fixDs"><span class="hs-identifier">fixDs</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-20"></span><span>        </span><span class="annot"><a href="../../base/src/Data.Foldable.html#foldlM"><span class="hs-identifier">foldlM</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/Data.Foldable.html#foldrM"><span class="hs-identifier">foldrM</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.Monad.html#whenGOptM"><span class="hs-identifier">whenGOptM</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.Monad.html#unsetGOptM"><span class="hs-identifier">unsetGOptM</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.Monad.html#unsetWOptM"><span class="hs-identifier">unsetWOptM</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.Monad.html#xoptM"><span class="hs-identifier">xoptM</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-21"></span><span>        </span><span class="annot"><a href="../../base/src/GHC.Base.html#Applicative"><span class="hs-identifier">Applicative</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/Data.Functor.html#%3C%24%3E"><span class="hs-operator">(&lt;$&gt;)</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-22"></span><span>
</span><span id="line-23"></span><span>        </span><span class="annot"><a href="GHC.HsToCore.Monad.html#duplicateLocalDs"><span class="hs-identifier">duplicateLocalDs</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.HsToCore.Monad.html#newSysLocalDsNoLP"><span class="hs-identifier">newSysLocalDsNoLP</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.HsToCore.Monad.html#newSysLocalDs"><span class="hs-identifier">newSysLocalDs</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-24"></span><span>        </span><span class="annot"><a href="GHC.HsToCore.Monad.html#newSysLocalsDsNoLP"><span class="hs-identifier">newSysLocalsDsNoLP</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.HsToCore.Monad.html#newSysLocalsDs"><span class="hs-identifier">newSysLocalsDs</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.HsToCore.Monad.html#newUniqueId"><span class="hs-identifier">newUniqueId</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-25"></span><span>        </span><span class="annot"><a href="GHC.HsToCore.Monad.html#newFailLocalDs"><span class="hs-identifier">newFailLocalDs</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.HsToCore.Monad.html#newPredVarDs"><span class="hs-identifier">newPredVarDs</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-26"></span><span>        </span><span class="annot"><a href="GHC.HsToCore.Monad.html#getSrcSpanDs"><span class="hs-identifier">getSrcSpanDs</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.HsToCore.Monad.html#putSrcSpanDs"><span class="hs-identifier">putSrcSpanDs</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-27"></span><span>        </span><span class="annot"><a href="GHC.HsToCore.Monad.html#mkPrintUnqualifiedDs"><span class="hs-identifier">mkPrintUnqualifiedDs</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-28"></span><span>        </span><span class="annot"><a href="GHC.Tc.Utils.Monad.html#newUnique"><span class="hs-identifier">newUnique</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-29"></span><span>        </span><span class="annot"><a href="GHC.Types.Unique.Supply.html#UniqSupply"><span class="hs-identifier">UniqSupply</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.Monad.html#newUniqueSupply"><span class="hs-identifier">newUniqueSupply</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-30"></span><span>        </span><span class="annot"><a href="GHC.HsToCore.Monad.html#getGhcModeDs"><span class="hs-identifier">getGhcModeDs</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.HsToCore.Monad.html#dsGetFamInstEnvs"><span class="hs-identifier">dsGetFamInstEnvs</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-31"></span><span>        </span><span class="annot"><a href="GHC.HsToCore.Monad.html#dsLookupGlobal"><span class="hs-identifier">dsLookupGlobal</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.HsToCore.Monad.html#dsLookupGlobalId"><span class="hs-identifier">dsLookupGlobalId</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.HsToCore.Monad.html#dsLookupTyCon"><span class="hs-identifier">dsLookupTyCon</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-32"></span><span>        </span><span class="annot"><a href="GHC.HsToCore.Monad.html#dsLookupDataCon"><span class="hs-identifier">dsLookupDataCon</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.HsToCore.Monad.html#dsLookupConLike"><span class="hs-identifier">dsLookupConLike</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-33"></span><span>
</span><span id="line-34"></span><span>        </span><span class="annot"><a href="GHC.Tc.Types.html#DsMetaEnv"><span class="hs-identifier">DsMetaEnv</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#DsMetaVal"><span class="hs-identifier">DsMetaVal</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.HsToCore.Monad.html#dsGetMetaEnv"><span class="hs-identifier">dsGetMetaEnv</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.HsToCore.Monad.html#dsLookupMetaEnv"><span class="hs-identifier">dsLookupMetaEnv</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.HsToCore.Monad.html#dsExtendMetaEnv"><span class="hs-identifier">dsExtendMetaEnv</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-35"></span><span>
</span><span id="line-36"></span><span>        </span><span class="hs-comment">-- Getting and setting pattern match oracle states</span><span>
</span><span id="line-37"></span><span>        </span><span class="annot"><a href="GHC.HsToCore.Monad.html#getPmDeltas"><span class="hs-identifier">getPmDeltas</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.HsToCore.Monad.html#updPmDeltas"><span class="hs-identifier">updPmDeltas</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-38"></span><span>
</span><span id="line-39"></span><span>        </span><span class="hs-comment">-- Get COMPLETE sets of a TyCon</span><span>
</span><span id="line-40"></span><span>        </span><span class="annot"><a href="GHC.HsToCore.Monad.html#dsGetCompleteMatches"><span class="hs-identifier">dsGetCompleteMatches</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-41"></span><span>
</span><span id="line-42"></span><span>        </span><span class="hs-comment">-- Warnings and errors</span><span>
</span><span id="line-43"></span><span>        </span><span class="annot"><a href="GHC.HsToCore.Monad.html#DsWarning"><span class="hs-identifier">DsWarning</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.HsToCore.Monad.html#warnDs"><span class="hs-identifier">warnDs</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.HsToCore.Monad.html#warnIfSetDs"><span class="hs-identifier">warnIfSetDs</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.HsToCore.Monad.html#errDs"><span class="hs-identifier">errDs</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.HsToCore.Monad.html#errDsCoreExpr"><span class="hs-identifier">errDsCoreExpr</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-44"></span><span>        </span><span class="annot"><a href="GHC.HsToCore.Monad.html#failWithDs"><span class="hs-identifier">failWithDs</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.HsToCore.Monad.html#failDs"><span class="hs-identifier">failDs</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.HsToCore.Monad.html#discardWarningsDs"><span class="hs-identifier">discardWarningsDs</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-45"></span><span>        </span><span class="annot"><a href="GHC.HsToCore.Monad.html#askNoErrsDs"><span class="hs-identifier">askNoErrsDs</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-46"></span><span>
</span><span id="line-47"></span><span>        </span><span class="hs-comment">-- Data types</span><span>
</span><span id="line-48"></span><span>        </span><span class="annot"><a href="GHC.HsToCore.Monad.html#DsMatchContext"><span class="hs-identifier">DsMatchContext</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
</span><span id="line-49"></span><span>        </span><span class="annot"><a href="GHC.HsToCore.Monad.html#EquationInfo"><span class="hs-identifier">EquationInfo</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.HsToCore.Monad.html#MatchResult"><span class="hs-identifier">MatchResult</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.HsToCore.Monad.html#runMatchResult"><span class="hs-identifier">runMatchResult</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.HsToCore.Monad.html#DsWrapper"><span class="hs-identifier">DsWrapper</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.HsToCore.Monad.html#idDsWrapper"><span class="hs-identifier">idDsWrapper</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-50"></span><span>
</span><span id="line-51"></span><span>        </span><span class="hs-comment">-- Levity polymorphism</span><span>
</span><span id="line-52"></span><span>        </span><span class="annot"><a href="GHC.HsToCore.Monad.html#dsNoLevPoly"><span class="hs-identifier">dsNoLevPoly</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.HsToCore.Monad.html#dsNoLevPolyExpr"><span class="hs-identifier">dsNoLevPolyExpr</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.HsToCore.Monad.html#dsWhenNoErrs"><span class="hs-identifier">dsWhenNoErrs</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-53"></span><span>
</span><span id="line-54"></span><span>        </span><span class="hs-comment">-- Trace injection</span><span>
</span><span id="line-55"></span><span>        </span><span class="annot"><a href="GHC.HsToCore.Monad.html#pprRuntimeTrace"><span class="hs-identifier">pprRuntimeTrace</span></a></span><span>
</span><span id="line-56"></span><span>    </span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-57"></span><span>
</span><span id="line-58"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Prelude.html"><span class="hs-identifier">GHC.Prelude</span></a></span><span>
</span><span id="line-59"></span><span>
</span><span id="line-60"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.Monad.html"><span class="hs-identifier">GHC.Tc.Utils.Monad</span></a></span><span>
</span><span id="line-61"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.FamInstEnv.html"><span class="hs-identifier">GHC.Core.FamInstEnv</span></a></span><span>
</span><span id="line-62"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.html"><span class="hs-identifier">GHC.Core</span></a></span><span>
</span><span id="line-63"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.Make.html"><span class="hs-identifier">GHC.Core.Make</span></a></span><span>  </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Core.Make.html#unitExpr"><span class="hs-identifier">unitExpr</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-64"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.Utils.html"><span class="hs-identifier">GHC.Core.Utils</span></a></span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Core.Utils.html#exprType"><span class="hs-identifier">exprType</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.Utils.html#isExprLevPoly"><span class="hs-identifier">isExprLevPoly</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-65"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Hs.html"><span class="hs-identifier">GHC.Hs</span></a></span><span>
</span><span id="line-66"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.IfaceToCore.html"><span class="hs-identifier">GHC.IfaceToCore</span></a></span><span>
</span><span id="line-67"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcMType.html"><span class="hs-identifier">GHC.Tc.Utils.TcMType</span></a></span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcMType.html#checkForLevPolyX"><span class="hs-identifier">checkForLevPolyX</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcMType.html#formatLevPolyErr"><span class="hs-identifier">formatLevPolyErr</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-68"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Builtin.Names.html"><span class="hs-identifier">GHC.Builtin.Names</span></a></span><span>
</span><span id="line-69"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Name.Reader.html"><span class="hs-identifier">GHC.Types.Name.Reader</span></a></span><span>
</span><span id="line-70"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Driver.Types.html"><span class="hs-identifier">GHC.Driver.Types</span></a></span><span>
</span><span id="line-71"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Data.Bag.html"><span class="hs-identifier">GHC.Data.Bag</span></a></span><span>
</span><span id="line-72"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Basic.html"><span class="hs-identifier">GHC.Types.Basic</span></a></span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Types.Basic.html#Origin"><span class="hs-identifier">Origin</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-73"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.DataCon.html"><span class="hs-identifier">GHC.Core.DataCon</span></a></span><span>
</span><span id="line-74"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.ConLike.html"><span class="hs-identifier">GHC.Core.ConLike</span></a></span><span>
</span><span id="line-75"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.TyCon.html"><span class="hs-identifier">GHC.Core.TyCon</span></a></span><span>
</span><span id="line-76"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.HsToCore.PmCheck.Types.html"><span class="hs-identifier">GHC.HsToCore.PmCheck.Types</span></a></span><span>
</span><span id="line-77"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Id.html"><span class="hs-identifier">GHC.Types.Id</span></a></span><span>
</span><span id="line-78"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Unit.Module.html"><span class="hs-identifier">GHC.Unit.Module</span></a></span><span>
</span><span id="line-79"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html"><span class="hs-identifier">GHC.Utils.Outputable</span></a></span><span>
</span><span id="line-80"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html"><span class="hs-identifier">GHC.Types.SrcLoc</span></a></span><span>
</span><span id="line-81"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.Type.html"><span class="hs-identifier">GHC.Core.Type</span></a></span><span>
</span><span id="line-82"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.Multiplicity.html"><span class="hs-identifier">GHC.Core.Multiplicity</span></a></span><span>
</span><span id="line-83"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Unique.Supply.html"><span class="hs-identifier">GHC.Types.Unique.Supply</span></a></span><span>
</span><span id="line-84"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Name.html"><span class="hs-identifier">GHC.Types.Name</span></a></span><span>
</span><span id="line-85"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Name.Env.html"><span class="hs-identifier">GHC.Types.Name.Env</span></a></span><span>
</span><span id="line-86"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html"><span class="hs-identifier">GHC.Driver.Session</span></a></span><span>
</span><span id="line-87"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Utils.Error.html"><span class="hs-identifier">GHC.Utils.Error</span></a></span><span>
</span><span id="line-88"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Data.FastString.html"><span class="hs-identifier">GHC.Data.FastString</span></a></span><span>
</span><span id="line-89"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Unique.FM.html"><span class="hs-identifier">GHC.Types.Unique.FM</span></a></span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Types.Unique.FM.html#lookupWithDefaultUFM_Directly"><span class="hs-identifier">lookupWithDefaultUFM_Directly</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-90"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Literal.html"><span class="hs-identifier">GHC.Types.Literal</span></a></span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Types.Literal.html#mkLitString"><span class="hs-identifier">mkLitString</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-91"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.CostCentre.State.html"><span class="hs-identifier">GHC.Types.CostCentre.State</span></a></span><span>
</span><span id="line-92"></span><span>
</span><span id="line-93"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Data.IORef.html#"><span class="hs-identifier">Data.IORef</span></a></span><span>
</span><span id="line-94"></span><span>
</span><span id="line-95"></span><span class="hs-comment">{-
************************************************************************
*                                                                      *
                Data types for the desugarer
*                                                                      *
************************************************************************
-}</span><span>
</span><span id="line-102"></span><span>
</span><span id="line-103"></span><span class="hs-keyword">data</span><span> </span><span id="DsMatchContext"><span class="annot"><a href="GHC.HsToCore.Monad.html#DsMatchContext"><span class="hs-identifier hs-var">DsMatchContext</span></a></span></span><span>
</span><span id="line-104"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span id="DsMatchContext"><span class="annot"><a href="GHC.HsToCore.Monad.html#DsMatchContext"><span class="hs-identifier hs-var">DsMatchContext</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Expr.html#HsMatchContext"><span class="hs-identifier hs-type">HsMatchContext</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcRn"><span class="hs-identifier hs-type">GhcRn</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html#SrcSpan"><span class="hs-identifier hs-type">SrcSpan</span></a></span><span>
</span><span id="line-105"></span><span>  </span><span class="hs-keyword">deriving</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-106"></span><span>
</span><span id="line-107"></span><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621681140365"><span class="annot"><a href="GHC.Utils.Outputable.html#Outputable"><span class="hs-identifier hs-type">Outputable</span></a></span><span> </span><span class="annot"><a href="GHC.HsToCore.Monad.html#DsMatchContext"><span class="hs-identifier hs-type">DsMatchContext</span></a></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-108"></span><span>  </span><span id="local-6989586621681140358"><span class="annot"><span class="annottext">ppr :: DsMatchContext -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var hs-var hs-var hs-var">ppr</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.HsToCore.Monad.html#DsMatchContext"><span class="hs-identifier hs-type">DsMatchContext</span></a></span><span> </span><span id="local-6989586621681140356"><span class="annot"><span class="annottext">HsMatchContext GhcRn
</span><a href="#local-6989586621681140356"><span class="hs-identifier hs-var">hs_match</span></a></span></span><span> </span><span id="local-6989586621681140355"><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681140355"><span class="hs-identifier hs-var">ss</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SrcSpan -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681140355"><span class="hs-identifier hs-var">ss</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">HsMatchContext GhcRn -&gt; SDoc
forall p. Outputable (IdP p) =&gt; HsMatchContext p -&gt; SDoc
</span><a href="GHC.Hs.Expr.html#pprMatchContext"><span class="hs-identifier hs-var">pprMatchContext</span></a></span><span> </span><span class="annot"><span class="annottext">HsMatchContext GhcRn
</span><a href="#local-6989586621681140356"><span class="hs-identifier hs-var">hs_match</span></a></span><span>
</span><span id="line-109"></span><span>
</span><span id="line-110"></span><span class="hs-keyword">data</span><span> </span><span id="EquationInfo"><span class="annot"><a href="GHC.HsToCore.Monad.html#EquationInfo"><span class="hs-identifier hs-var">EquationInfo</span></a></span></span><span>
</span><span id="line-111"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span id="EqnInfo"><span class="annot"><a href="GHC.HsToCore.Monad.html#EqnInfo"><span class="hs-identifier hs-var">EqnInfo</span></a></span></span><span> </span><span class="hs-special">{</span><span> </span><span id="eqn_pats"><span class="annot"><span class="annottext">EquationInfo -&gt; [Pat GhcTc]
</span><a href="GHC.HsToCore.Monad.html#eqn_pats"><span class="hs-identifier hs-var hs-var">eqn_pats</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Hs.Pat.html#Pat"><span class="hs-identifier hs-type">Pat</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcTc"><span class="hs-identifier hs-type">GhcTc</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-112"></span><span>              </span><span class="hs-comment">-- ^ The patterns for an equation</span><span>
</span><span id="line-113"></span><span>              </span><span class="hs-comment">--</span><span>
</span><span id="line-114"></span><span>              </span><span class="hs-comment">-- NB: We have /already/ applied 'decideBangHood' to</span><span>
</span><span id="line-115"></span><span>              </span><span class="hs-comment">-- these patterns.  See Note [decideBangHood] in &quot;GHC.HsToCore.Utils&quot;</span><span>
</span><span id="line-116"></span><span>
</span><span id="line-117"></span><span>            </span><span class="hs-special">,</span><span> </span><span id="eqn_orig"><span class="annot"><span class="annottext">EquationInfo -&gt; Origin
</span><a href="GHC.HsToCore.Monad.html#eqn_orig"><span class="hs-identifier hs-var hs-var">eqn_orig</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Basic.html#Origin"><span class="hs-identifier hs-type">Origin</span></a></span><span>
</span><span id="line-118"></span><span>              </span><span class="hs-comment">-- ^ Was this equation present in the user source?</span><span>
</span><span id="line-119"></span><span>              </span><span class="hs-comment">--</span><span>
</span><span id="line-120"></span><span>              </span><span class="hs-comment">-- This helps us avoid warnings on patterns that GHC elaborated.</span><span>
</span><span id="line-121"></span><span>              </span><span class="hs-comment">--</span><span>
</span><span id="line-122"></span><span>              </span><span class="hs-comment">-- For instance, the pattern @-1 :: Word@ gets desugared into</span><span>
</span><span id="line-123"></span><span>              </span><span class="hs-comment">-- @W# -1## :: Word@, but we shouldn't warn about an overflowed</span><span>
</span><span id="line-124"></span><span>              </span><span class="hs-comment">-- literal for /both/ of these cases.</span><span>
</span><span id="line-125"></span><span>
</span><span id="line-126"></span><span>            </span><span class="hs-special">,</span><span> </span><span id="eqn_rhs"><span class="annot"><span class="annottext">EquationInfo -&gt; MatchResult CoreExpr
</span><a href="GHC.HsToCore.Monad.html#eqn_rhs"><span class="hs-identifier hs-var hs-var">eqn_rhs</span></a></span></span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.HsToCore.Monad.html#MatchResult"><span class="hs-identifier hs-type">MatchResult</span></a></span><span> </span><span class="annot"><a href="GHC.Core.html#CoreExpr"><span class="hs-identifier hs-type">CoreExpr</span></a></span><span>
</span><span id="line-127"></span><span>              </span><span class="hs-comment">-- ^ What to do after match</span><span>
</span><span id="line-128"></span><span>            </span><span class="hs-special">}</span><span>
</span><span id="line-129"></span><span>
</span><span id="line-130"></span><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621681140346"><span class="annot"><a href="GHC.Utils.Outputable.html#Outputable"><span class="hs-identifier hs-type">Outputable</span></a></span><span> </span><span class="annot"><a href="GHC.HsToCore.Monad.html#EquationInfo"><span class="hs-identifier hs-type">EquationInfo</span></a></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-131"></span><span>    </span><span id="local-6989586621681140333"><span class="annot"><span class="annottext">ppr :: EquationInfo -&gt; SDoc
</span><a href="#local-6989586621681140333"><span class="hs-identifier hs-var hs-var hs-var hs-var">ppr</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.HsToCore.Monad.html#EqnInfo"><span class="hs-identifier hs-type">EqnInfo</span></a></span><span> </span><span id="local-6989586621681140332"><span class="annot"><span class="annottext">[Pat GhcTc]
</span><a href="#local-6989586621681140332"><span class="hs-identifier hs-var">pats</span></a></span></span><span> </span><span class="annot"><span class="annottext">Origin
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">MatchResult CoreExpr
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Pat GhcTc] -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">[Pat GhcTc]
</span><a href="#local-6989586621681140332"><span class="hs-identifier hs-var">pats</span></a></span><span>
</span><span id="line-132"></span><span>
</span><span id="line-133"></span><span class="hs-keyword">type</span><span> </span><span id="DsWrapper"><span class="annot"><a href="GHC.HsToCore.Monad.html#DsWrapper"><span class="hs-identifier hs-var">DsWrapper</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="GHC.Core.html#CoreExpr"><span class="hs-identifier hs-type">CoreExpr</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.html#CoreExpr"><span class="hs-identifier hs-type">CoreExpr</span></a></span><span>
</span><span id="line-134"></span><span class="annot"><a href="GHC.HsToCore.Monad.html#idDsWrapper"><span class="hs-identifier hs-type">idDsWrapper</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.HsToCore.Monad.html#DsWrapper"><span class="hs-identifier hs-type">DsWrapper</span></a></span><span>
</span><span id="line-135"></span><span id="idDsWrapper"><span class="annot"><span class="annottext">idDsWrapper :: DsWrapper
</span><a href="GHC.HsToCore.Monad.html#idDsWrapper"><span class="hs-identifier hs-var hs-var">idDsWrapper</span></a></span></span><span> </span><span id="local-6989586621681140331"><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681140331"><span class="hs-identifier hs-var">e</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681140331"><span class="hs-identifier hs-var">e</span></a></span><span>
</span><span id="line-136"></span><span>
</span><span id="line-137"></span><span class="hs-comment">-- The semantics of (match vs (EqnInfo wrap pats rhs)) is the MatchResult CoreExpr</span><span>
</span><span id="line-138"></span><span class="hs-comment">--      \fail. wrap (case vs of { pats -&gt; rhs fail })</span><span>
</span><span id="line-139"></span><span class="hs-comment">-- where vs are not bound by wrap</span><span>
</span><span id="line-140"></span><span>
</span><span id="line-141"></span><span class="hs-comment">-- | This is a value of type a with potentially a CoreExpr-shaped hole in it.</span><span>
</span><span id="line-142"></span><span class="hs-comment">-- This is used to deal with cases where we are potentially handling pattern</span><span>
</span><span id="line-143"></span><span class="hs-comment">-- match failure, and want to later specify how failure is handled.</span><span>
</span><span id="line-144"></span><span class="hs-keyword">data</span><span> </span><span id="MatchResult"><span class="annot"><a href="GHC.HsToCore.Monad.html#MatchResult"><span class="hs-identifier hs-var">MatchResult</span></a></span></span><span> </span><span id="local-6989586621681140700"><span class="annot"><a href="#local-6989586621681140700"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-145"></span><span>  </span><span class="hs-comment">-- | We represent the case where there is no hole without a function from</span><span>
</span><span id="line-146"></span><span>  </span><span class="hs-comment">-- 'CoreExpr', like this, because sometimes we have nothing to put in the</span><span>
</span><span id="line-147"></span><span>  </span><span class="hs-comment">-- hole and so want to be sure there is in fact no hole.</span><span>
</span><span id="line-148"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span id="MR_Infallible"><span class="annot"><a href="GHC.HsToCore.Monad.html#MR_Infallible"><span class="hs-identifier hs-var">MR_Infallible</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.html#DsM"><span class="hs-identifier hs-type">DsM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681140700"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-149"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="MR_Fallible"><span class="annot"><a href="GHC.HsToCore.Monad.html#MR_Fallible"><span class="hs-identifier hs-var">MR_Fallible</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.html#CoreExpr"><span class="hs-identifier hs-type">CoreExpr</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#DsM"><span class="hs-identifier hs-type">DsM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681140700"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-150"></span><span>  </span><span class="hs-keyword">deriving</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681140323"><span id="local-6989586621681140327"><span class="annot"><span class="annottext">(forall a b. (a -&gt; b) -&gt; MatchResult a -&gt; MatchResult b)
-&gt; (forall a b. a -&gt; MatchResult b -&gt; MatchResult a)
-&gt; Functor MatchResult
forall a b. a -&gt; MatchResult b -&gt; MatchResult a
forall a b. (a -&gt; b) -&gt; MatchResult a -&gt; MatchResult b
forall (f :: * -&gt; *).
(forall a b. (a -&gt; b) -&gt; f a -&gt; f b)
-&gt; (forall a b. a -&gt; f b -&gt; f a) -&gt; Functor f
&lt;$ :: forall a b. a -&gt; MatchResult b -&gt; MatchResult a
$c&lt;$ :: forall a b. a -&gt; MatchResult b -&gt; MatchResult a
fmap :: forall a b. (a -&gt; b) -&gt; MatchResult a -&gt; MatchResult b
$cfmap :: forall a b. (a -&gt; b) -&gt; MatchResult a -&gt; MatchResult b
</span><a href="../../base/src/GHC.Base.html#Functor"><span class="hs-identifier hs-var hs-var hs-var hs-var hs-var hs-var">Functor</span></a></span></span></span><span class="hs-special">)</span><span>
</span><span id="line-151"></span><span>
</span><span id="line-152"></span><span class="hs-comment">-- | Product is an &quot;or&quot; on falliblity---the combined match result is infallible</span><span>
</span><span id="line-153"></span><span class="hs-comment">-- only if the left and right argument match results both were.</span><span>
</span><span id="line-154"></span><span class="hs-comment">--</span><span>
</span><span id="line-155"></span><span class="hs-comment">-- This is useful for combining a bunch of alternatives together and then</span><span>
</span><span id="line-156"></span><span class="hs-comment">-- getting the overall falliblity of the entire group. See 'mkDataConCase' for</span><span>
</span><span id="line-157"></span><span class="hs-comment">-- an example.</span><span>
</span><span id="line-158"></span><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621681140309"><span id="local-6989586621681140311"><span id="local-6989586621681140313"><span class="annot"><a href="../../base/src/GHC.Base.html#Applicative"><span class="hs-identifier hs-type">Applicative</span></a></span><span> </span><span class="annot"><a href="GHC.HsToCore.Monad.html#MatchResult"><span class="hs-identifier hs-type">MatchResult</span></a></span></span></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-159"></span><span>  </span><span id="local-6989586621681140305"><span class="annot"><span class="annottext">pure :: forall a. a -&gt; MatchResult a
</span><a href="../../base/src/GHC.Base.html#pure"><span class="hs-identifier hs-var hs-var hs-var hs-var">pure</span></a></span></span><span> </span><span id="local-6989586621681140304"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621681140304"><span class="hs-identifier hs-var">v</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DsM a -&gt; MatchResult a
forall a. DsM a -&gt; MatchResult a
</span><a href="GHC.HsToCore.Monad.html#MR_Infallible"><span class="hs-identifier hs-var">MR_Infallible</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; DsM a
forall (f :: * -&gt; *) a. Applicative f =&gt; a -&gt; f a
</span><a href="../../base/src/GHC.Base.html#pure"><span class="hs-identifier hs-var">pure</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621681140304"><span class="hs-identifier hs-var">v</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-160"></span><span>  </span><span class="annot"><a href="GHC.HsToCore.Monad.html#MR_Infallible"><span class="hs-identifier hs-type">MR_Infallible</span></a></span><span> </span><span id="local-6989586621681140301"><span class="annot"><span class="annottext">DsM (a -&gt; b)
</span><a href="#local-6989586621681140301"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621681140300"><span class="annot"><span class="annottext">&lt;*&gt; :: forall a b. MatchResult (a -&gt; b) -&gt; MatchResult a -&gt; MatchResult b
</span><a href="../../base/src/GHC.Base.html#%3C%2A%3E"><span class="hs-operator hs-var hs-var hs-var hs-var">&lt;*&gt;</span></a></span></span><span> </span><span class="annot"><a href="GHC.HsToCore.Monad.html#MR_Infallible"><span class="hs-identifier hs-type">MR_Infallible</span></a></span><span> </span><span id="local-6989586621681140299"><span class="annot"><span class="annottext">DsM a
</span><a href="#local-6989586621681140299"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DsM b -&gt; MatchResult b
forall a. DsM a -&gt; MatchResult a
</span><a href="GHC.HsToCore.Monad.html#MR_Infallible"><span class="hs-identifier hs-var">MR_Infallible</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DsM (a -&gt; b)
</span><a href="#local-6989586621681140301"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">DsM (a -&gt; b) -&gt; DsM a -&gt; DsM b
forall (f :: * -&gt; *) a b. Applicative f =&gt; f (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/GHC.Base.html#%3C%2A%3E"><span class="hs-operator hs-var">&lt;*&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">DsM a
</span><a href="#local-6989586621681140299"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-161"></span><span>  </span><span id="local-6989586621681140298"><span class="annot"><span class="annottext">MatchResult (a -&gt; b)
</span><a href="#local-6989586621681140298"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#%3C%2A%3E"><span class="hs-operator hs-var">&lt;*&gt;</span></a></span><span> </span><span id="local-6989586621681140297"><span class="annot"><span class="annottext">MatchResult a
</span><a href="#local-6989586621681140297"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(CoreExpr -&gt; DsM b) -&gt; MatchResult b
forall a. (CoreExpr -&gt; DsM a) -&gt; MatchResult a
</span><a href="GHC.HsToCore.Monad.html#MR_Fallible"><span class="hs-identifier hs-var">MR_Fallible</span></a></span><span> </span><span class="annot"><span class="annottext">((CoreExpr -&gt; DsM b) -&gt; MatchResult b)
-&gt; (CoreExpr -&gt; DsM b) -&gt; MatchResult b
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621681140296"><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681140296"><span class="hs-identifier hs-var">fail</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">CoreExpr -&gt; MatchResult (a -&gt; b) -&gt; DsM (a -&gt; b)
forall a. CoreExpr -&gt; MatchResult a -&gt; DsM a
</span><a href="GHC.HsToCore.Monad.html#runMatchResult"><span class="hs-identifier hs-var">runMatchResult</span></a></span><span> </span><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681140296"><span class="hs-identifier hs-var">fail</span></a></span><span> </span><span class="annot"><span class="annottext">MatchResult (a -&gt; b)
</span><a href="#local-6989586621681140298"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">DsM (a -&gt; b) -&gt; DsM a -&gt; DsM b
forall (f :: * -&gt; *) a b. Applicative f =&gt; f (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/GHC.Base.html#%3C%2A%3E"><span class="hs-operator hs-var">&lt;*&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">CoreExpr -&gt; MatchResult a -&gt; DsM a
forall a. CoreExpr -&gt; MatchResult a -&gt; DsM a
</span><a href="GHC.HsToCore.Monad.html#runMatchResult"><span class="hs-identifier hs-var">runMatchResult</span></a></span><span> </span><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681140296"><span class="hs-identifier hs-var">fail</span></a></span><span> </span><span class="annot"><span class="annottext">MatchResult a
</span><a href="#local-6989586621681140297"><span class="hs-identifier hs-var">x</span></a></span><span>
</span><span id="line-162"></span><span>
</span><span id="line-163"></span><span class="hs-comment">-- Given a fail expression to use, and a MatchResult CoreExpr, compute the filled CoreExpr whether</span><span>
</span><span id="line-164"></span><span class="hs-comment">-- the MatchResult CoreExpr was failable or not.</span><span>
</span><span id="line-165"></span><span id="local-6989586621681140694"><span class="annot"><a href="GHC.HsToCore.Monad.html#runMatchResult"><span class="hs-identifier hs-type">runMatchResult</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.html#CoreExpr"><span class="hs-identifier hs-type">CoreExpr</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.HsToCore.Monad.html#MatchResult"><span class="hs-identifier hs-type">MatchResult</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681140694"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#DsM"><span class="hs-identifier hs-type">DsM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681140694"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-166"></span><span id="runMatchResult"><span class="annot"><span class="annottext">runMatchResult :: forall a. CoreExpr -&gt; MatchResult a -&gt; DsM a
</span><a href="GHC.HsToCore.Monad.html#runMatchResult"><span class="hs-identifier hs-var hs-var">runMatchResult</span></a></span></span><span> </span><span id="local-6989586621681140295"><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681140295"><span class="hs-identifier hs-var">fail</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-glyph">\</span><span class="hs-glyph">case</span><span>
</span><span id="line-167"></span><span>  </span><span class="annot"><a href="GHC.HsToCore.Monad.html#MR_Infallible"><span class="hs-identifier hs-type">MR_Infallible</span></a></span><span> </span><span id="local-6989586621681140294"><span class="annot"><span class="annottext">DsM a
</span><a href="#local-6989586621681140294"><span class="hs-identifier hs-var">body</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">DsM a
</span><a href="#local-6989586621681140294"><span class="hs-identifier hs-var">body</span></a></span><span>
</span><span id="line-168"></span><span>  </span><span class="annot"><a href="GHC.HsToCore.Monad.html#MR_Fallible"><span class="hs-identifier hs-type">MR_Fallible</span></a></span><span> </span><span id="local-6989586621681140293"><span class="annot"><span class="annottext">CoreExpr -&gt; DsM a
</span><a href="#local-6989586621681140293"><span class="hs-identifier hs-var">body_fn</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">CoreExpr -&gt; DsM a
</span><a href="#local-6989586621681140293"><span class="hs-identifier hs-var">body_fn</span></a></span><span> </span><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681140295"><span class="hs-identifier hs-var">fail</span></a></span><span>
</span><span id="line-169"></span><span>
</span><span id="line-170"></span><span class="hs-comment">{-
************************************************************************
*                                                                      *
                Monad functions
*                                                                      *
************************************************************************
-}</span><span>
</span><span id="line-177"></span><span>
</span><span id="line-178"></span><span class="hs-comment">-- Compatibility functions</span><span>
</span><span id="line-179"></span><span id="local-6989586621681140692"><span class="annot"><a href="GHC.HsToCore.Monad.html#fixDs"><span class="hs-identifier hs-type">fixDs</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621681140692"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#DsM"><span class="hs-identifier hs-type">DsM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681140692"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#DsM"><span class="hs-identifier hs-type">DsM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681140692"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-180"></span><span id="fixDs"><span class="annot"><span class="annottext">fixDs :: forall a. (a -&gt; DsM a) -&gt; DsM a
</span><a href="GHC.HsToCore.Monad.html#fixDs"><span class="hs-identifier hs-var hs-var">fixDs</span></a></span></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a -&gt; IOEnv (Env DsGblEnv DsLclEnv) a)
-&gt; IOEnv (Env DsGblEnv DsLclEnv) a
forall a env. (a -&gt; IOEnv env a) -&gt; IOEnv env a
</span><a href="GHC.Data.IOEnv.html#fixM"><span class="hs-identifier hs-var">fixM</span></a></span><span>
</span><span id="line-181"></span><span>
</span><span id="line-182"></span><span class="hs-keyword">type</span><span> </span><span id="DsWarning"><span class="annot"><a href="GHC.HsToCore.Monad.html#DsWarning"><span class="hs-identifier hs-var">DsWarning</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#SrcSpan"><span class="hs-identifier hs-type">SrcSpan</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#SDoc"><span class="hs-identifier hs-type">SDoc</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-183"></span><span>        </span><span class="hs-comment">-- Not quite the same as a WarnMsg, we have an SDoc here</span><span>
</span><span id="line-184"></span><span>        </span><span class="hs-comment">-- and we'll do the print_unqual stuff later on to turn it</span><span>
</span><span id="line-185"></span><span>        </span><span class="hs-comment">-- into a Doc.</span><span>
</span><span id="line-186"></span><span>
</span><span id="line-187"></span><span class="hs-comment">-- | Run a 'DsM' action inside the 'TcM' monad.</span><span>
</span><span id="line-188"></span><span id="local-6989586621681140688"><span class="annot"><a href="GHC.HsToCore.Monad.html#initDsTc"><span class="hs-identifier hs-type">initDsTc</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#DsM"><span class="hs-identifier hs-type">DsM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681140688"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcM"><span class="hs-identifier hs-type">TcM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681140688"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-189"></span><span id="initDsTc"><span class="annot"><span class="annottext">initDsTc :: forall a. DsM a -&gt; TcM a
</span><a href="GHC.HsToCore.Monad.html#initDsTc"><span class="hs-identifier hs-var hs-var">initDsTc</span></a></span></span><span> </span><span id="local-6989586621681140285"><span class="annot"><span class="annottext">DsM a
</span><a href="#local-6989586621681140285"><span class="hs-identifier hs-var">thing_inside</span></a></span></span><span>
</span><span id="line-190"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span id="local-6989586621681140284"><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681140284"><span class="hs-identifier hs-var">tcg_env</span></a></span></span><span>  </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TcRnIf TcGblEnv TcLclEnv TcGblEnv
forall gbl lcl. TcRnIf gbl lcl gbl
</span><a href="GHC.Tc.Utils.Monad.html#getGblEnv"><span class="hs-identifier hs-var">getGblEnv</span></a></span><span>
</span><span id="line-191"></span><span>       </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681140282"><span class="annot"><span class="annottext">TcRef Messages
</span><a href="#local-6989586621681140282"><span class="hs-identifier hs-var">msg_var</span></a></span></span><span>  </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TcRn (TcRef Messages)
</span><a href="GHC.Tc.Utils.Monad.html#getErrsVar"><span class="hs-identifier hs-var">getErrsVar</span></a></span><span>
</span><span id="line-192"></span><span>       </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681140280"><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681140280"><span class="hs-identifier hs-var">hsc_env</span></a></span></span><span>  </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TcRnIf TcGblEnv TcLclEnv HscEnv
forall gbl lcl. TcRnIf gbl lcl HscEnv
</span><a href="GHC.Tc.Utils.Monad.html#getTopEnv"><span class="hs-identifier hs-var">getTopEnv</span></a></span><span>
</span><span id="line-193"></span><span>       </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681140278"><span class="annot"><span class="annottext">(DsGblEnv, DsLclEnv)
</span><a href="#local-6989586621681140278"><span class="hs-identifier hs-var">envs</span></a></span></span><span>     </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">HscEnv
-&gt; TcRef Messages
-&gt; TcGblEnv
-&gt; IOEnv (Env TcGblEnv TcLclEnv) (DsGblEnv, DsLclEnv)
forall (m :: * -&gt; *).
MonadIO m =&gt;
HscEnv -&gt; TcRef Messages -&gt; TcGblEnv -&gt; m (DsGblEnv, DsLclEnv)
</span><a href="GHC.HsToCore.Monad.html#mkDsEnvsFromTcGbl"><span class="hs-identifier hs-var">mkDsEnvsFromTcGbl</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681140280"><span class="hs-identifier hs-var">hsc_env</span></a></span><span> </span><span class="annot"><span class="annottext">TcRef Messages
</span><a href="#local-6989586621681140282"><span class="hs-identifier hs-var">msg_var</span></a></span><span> </span><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681140284"><span class="hs-identifier hs-var">tcg_env</span></a></span><span>
</span><span id="line-194"></span><span>       </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">(DsGblEnv, DsLclEnv) -&gt; DsM a -&gt; TcM a
forall gbl' lcl' a gbl lcl.
(gbl', lcl') -&gt; TcRnIf gbl' lcl' a -&gt; TcRnIf gbl lcl a
</span><a href="GHC.Tc.Utils.Monad.html#setEnvs"><span class="hs-identifier hs-var">setEnvs</span></a></span><span> </span><span class="annot"><span class="annottext">(DsGblEnv, DsLclEnv)
</span><a href="#local-6989586621681140278"><span class="hs-identifier hs-var">envs</span></a></span><span> </span><span class="annot"><span class="annottext">DsM a
</span><a href="#local-6989586621681140285"><span class="hs-identifier hs-var">thing_inside</span></a></span><span>
</span><span id="line-195"></span><span>       </span><span class="hs-special">}</span><span>
</span><span id="line-196"></span><span>
</span><span id="line-197"></span><span class="hs-comment">-- | Run a 'DsM' action inside the 'IO' monad.</span><span>
</span><span id="line-198"></span><span id="local-6989586621681140666"><span class="annot"><a href="GHC.HsToCore.Monad.html#initDs"><span class="hs-identifier hs-type">initDs</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Types.html#HscEnv"><span class="hs-identifier hs-type">HscEnv</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcGblEnv"><span class="hs-identifier hs-type">TcGblEnv</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#DsM"><span class="hs-identifier hs-type">DsM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681140666"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Utils.Error.html#Messages"><span class="hs-identifier hs-type">Messages</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681140666"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span></span><span>
</span><span id="line-199"></span><span id="initDs"><span class="annot"><span class="annottext">initDs :: forall a. HscEnv -&gt; TcGblEnv -&gt; DsM a -&gt; IO (Messages, Maybe a)
</span><a href="GHC.HsToCore.Monad.html#initDs"><span class="hs-identifier hs-var hs-var">initDs</span></a></span></span><span> </span><span id="local-6989586621681140270"><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681140270"><span class="hs-identifier hs-var">hsc_env</span></a></span></span><span> </span><span id="local-6989586621681140269"><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681140269"><span class="hs-identifier hs-var">tcg_env</span></a></span></span><span> </span><span id="local-6989586621681140268"><span class="annot"><span class="annottext">DsM a
</span><a href="#local-6989586621681140268"><span class="hs-identifier hs-var">thing_inside</span></a></span></span><span>
</span><span id="line-200"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span id="local-6989586621681140267"><span class="annot"><span class="annottext">TcRef Messages
</span><a href="#local-6989586621681140267"><span class="hs-identifier hs-var">msg_var</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Messages -&gt; IO (TcRef Messages)
forall a. a -&gt; IO (IORef a)
</span><a href="../../base/src/GHC.IORef.html#newIORef"><span class="hs-identifier hs-var">newIORef</span></a></span><span> </span><span class="annot"><span class="annottext">Messages
</span><a href="GHC.Utils.Error.html#emptyMessages"><span class="hs-identifier hs-var">emptyMessages</span></a></span><span>
</span><span id="line-201"></span><span>       </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681140264"><span class="annot"><span class="annottext">(DsGblEnv, DsLclEnv)
</span><a href="#local-6989586621681140264"><span class="hs-identifier hs-var">envs</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">HscEnv -&gt; TcRef Messages -&gt; TcGblEnv -&gt; IO (DsGblEnv, DsLclEnv)
forall (m :: * -&gt; *).
MonadIO m =&gt;
HscEnv -&gt; TcRef Messages -&gt; TcGblEnv -&gt; m (DsGblEnv, DsLclEnv)
</span><a href="GHC.HsToCore.Monad.html#mkDsEnvsFromTcGbl"><span class="hs-identifier hs-var">mkDsEnvsFromTcGbl</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681140270"><span class="hs-identifier hs-var">hsc_env</span></a></span><span> </span><span class="annot"><span class="annottext">TcRef Messages
</span><a href="#local-6989586621681140267"><span class="hs-identifier hs-var">msg_var</span></a></span><span> </span><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681140269"><span class="hs-identifier hs-var">tcg_env</span></a></span><span>
</span><span id="line-202"></span><span>       </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">HscEnv -&gt; (DsGblEnv, DsLclEnv) -&gt; DsM a -&gt; IO (Messages, Maybe a)
forall a.
HscEnv -&gt; (DsGblEnv, DsLclEnv) -&gt; DsM a -&gt; IO (Messages, Maybe a)
</span><a href="GHC.HsToCore.Monad.html#runDs"><span class="hs-identifier hs-var">runDs</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681140270"><span class="hs-identifier hs-var">hsc_env</span></a></span><span> </span><span class="annot"><span class="annottext">(DsGblEnv, DsLclEnv)
</span><a href="#local-6989586621681140264"><span class="hs-identifier hs-var">envs</span></a></span><span> </span><span class="annot"><span class="annottext">DsM a
</span><a href="#local-6989586621681140268"><span class="hs-identifier hs-var">thing_inside</span></a></span><span>
</span><span id="line-203"></span><span>       </span><span class="hs-special">}</span><span>
</span><span id="line-204"></span><span>
</span><span id="line-205"></span><span class="hs-comment">-- | Build a set of desugarer environments derived from a 'TcGblEnv'.</span><span>
</span><span id="line-206"></span><span id="local-6989586621681140672"><span class="annot"><a href="GHC.HsToCore.Monad.html#mkDsEnvsFromTcGbl"><span class="hs-identifier hs-type">mkDsEnvsFromTcGbl</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/Control.Monad.IO.Class.html#MonadIO"><span class="hs-identifier hs-type">MonadIO</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681140672"><span class="hs-identifier hs-type">m</span></a></span><span>
</span><span id="line-207"></span><span>                  </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="GHC.Driver.Types.html#HscEnv"><span class="hs-identifier hs-type">HscEnv</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.IORef.html#IORef"><span class="hs-identifier hs-type">IORef</span></a></span><span> </span><span class="annot"><a href="GHC.Utils.Error.html#Messages"><span class="hs-identifier hs-type">Messages</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcGblEnv"><span class="hs-identifier hs-type">TcGblEnv</span></a></span><span>
</span><span id="line-208"></span><span>                  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621681140672"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.html#DsGblEnv"><span class="hs-identifier hs-type">DsGblEnv</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#DsLclEnv"><span class="hs-identifier hs-type">DsLclEnv</span></a></span><span class="hs-special">)</span></span><span>
</span><span id="line-209"></span><span id="mkDsEnvsFromTcGbl"><span class="annot"><span class="annottext">mkDsEnvsFromTcGbl :: forall (m :: * -&gt; *).
MonadIO m =&gt;
HscEnv -&gt; TcRef Messages -&gt; TcGblEnv -&gt; m (DsGblEnv, DsLclEnv)
</span><a href="GHC.HsToCore.Monad.html#mkDsEnvsFromTcGbl"><span class="hs-identifier hs-var hs-var">mkDsEnvsFromTcGbl</span></a></span></span><span> </span><span id="local-6989586621681140256"><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681140256"><span class="hs-identifier hs-var">hsc_env</span></a></span></span><span> </span><span id="local-6989586621681140255"><span class="annot"><span class="annottext">TcRef Messages
</span><a href="#local-6989586621681140255"><span class="hs-identifier hs-var">msg_var</span></a></span></span><span> </span><span id="local-6989586621681140254"><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681140254"><span class="hs-identifier hs-var">tcg_env</span></a></span></span><span>
</span><span id="line-210"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span id="local-6989586621681140253"><span class="annot"><span class="annottext">IORef CostCentreState
</span><a href="#local-6989586621681140253"><span class="hs-identifier hs-var">cc_st_var</span></a></span></span><span>   </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">IO (IORef CostCentreState) -&gt; m (IORef CostCentreState)
forall (m :: * -&gt; *) a. MonadIO m =&gt; IO a -&gt; m a
</span><a href="../../base/src/Control.Monad.IO.Class.html#liftIO"><span class="hs-identifier hs-var">liftIO</span></a></span><span> </span><span class="annot"><span class="annottext">(IO (IORef CostCentreState) -&gt; m (IORef CostCentreState))
-&gt; IO (IORef CostCentreState) -&gt; m (IORef CostCentreState)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">CostCentreState -&gt; IO (IORef CostCentreState)
forall a. a -&gt; IO (IORef a)
</span><a href="../../base/src/GHC.IORef.html#newIORef"><span class="hs-identifier hs-var">newIORef</span></a></span><span> </span><span class="annot"><span class="annottext">CostCentreState
</span><a href="GHC.Types.CostCentre.State.html#newCostCentreState"><span class="hs-identifier hs-var">newCostCentreState</span></a></span><span>
</span><span id="line-211"></span><span>       </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681140250"><span class="annot"><span class="annottext">dflags :: DynFlags
</span><a href="#local-6989586621681140250"><span class="hs-identifier hs-var hs-var">dflags</span></a></span></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HscEnv -&gt; DynFlags
</span><a href="GHC.Driver.Types.html#hsc_dflags"><span class="hs-identifier hs-var hs-var">hsc_dflags</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681140256"><span class="hs-identifier hs-var">hsc_env</span></a></span><span>
</span><span id="line-212"></span><span>             </span><span id="local-6989586621681140248"><span class="annot"><span class="annottext">this_mod :: Module
</span><a href="#local-6989586621681140248"><span class="hs-identifier hs-var hs-var">this_mod</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TcGblEnv -&gt; Module
</span><a href="GHC.Tc.Types.html#tcg_mod"><span class="hs-identifier hs-var hs-var">tcg_mod</span></a></span><span> </span><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681140254"><span class="hs-identifier hs-var">tcg_env</span></a></span><span>
</span><span id="line-213"></span><span>             </span><span id="local-6989586621681140246"><span class="annot"><span class="annottext">type_env :: TypeEnv
</span><a href="#local-6989586621681140246"><span class="hs-identifier hs-var hs-var">type_env</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TcGblEnv -&gt; TypeEnv
</span><a href="GHC.Tc.Types.html#tcg_type_env"><span class="hs-identifier hs-var hs-var">tcg_type_env</span></a></span><span> </span><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681140254"><span class="hs-identifier hs-var">tcg_env</span></a></span><span>
</span><span id="line-214"></span><span>             </span><span id="local-6989586621681140244"><span class="annot"><span class="annottext">rdr_env :: GlobalRdrEnv
</span><a href="#local-6989586621681140244"><span class="hs-identifier hs-var hs-var">rdr_env</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TcGblEnv -&gt; GlobalRdrEnv
</span><a href="GHC.Tc.Types.html#tcg_rdr_env"><span class="hs-identifier hs-var hs-var">tcg_rdr_env</span></a></span><span> </span><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681140254"><span class="hs-identifier hs-var">tcg_env</span></a></span><span>
</span><span id="line-215"></span><span>             </span><span id="local-6989586621681140242"><span class="annot"><span class="annottext">fam_inst_env :: FamInstEnv
</span><a href="#local-6989586621681140242"><span class="hs-identifier hs-var hs-var">fam_inst_env</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TcGblEnv -&gt; FamInstEnv
</span><a href="GHC.Tc.Types.html#tcg_fam_inst_env"><span class="hs-identifier hs-var hs-var">tcg_fam_inst_env</span></a></span><span> </span><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681140254"><span class="hs-identifier hs-var">tcg_env</span></a></span><span>
</span><span id="line-216"></span><span>             </span><span id="local-6989586621681140240"><span class="annot"><span class="annottext">complete_matches :: [CompleteMatch]
</span><a href="#local-6989586621681140240"><span class="hs-identifier hs-var hs-var">complete_matches</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HscEnv -&gt; [CompleteMatch]
</span><a href="GHC.Driver.Types.html#hptCompleteSigs"><span class="hs-identifier hs-var">hptCompleteSigs</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681140256"><span class="hs-identifier hs-var">hsc_env</span></a></span><span>
</span><span id="line-217"></span><span>                                </span><span class="annot"><span class="annottext">[CompleteMatch] -&gt; [CompleteMatch] -&gt; [CompleteMatch]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">TcGblEnv -&gt; [CompleteMatch]
</span><a href="GHC.Tc.Types.html#tcg_complete_matches"><span class="hs-identifier hs-var hs-var">tcg_complete_matches</span></a></span><span> </span><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681140254"><span class="hs-identifier hs-var">tcg_env</span></a></span><span>
</span><span id="line-218"></span><span>       </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">(DsGblEnv, DsLclEnv) -&gt; m (DsGblEnv, DsLclEnv)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">((DsGblEnv, DsLclEnv) -&gt; m (DsGblEnv, DsLclEnv))
-&gt; (DsGblEnv, DsLclEnv) -&gt; m (DsGblEnv, DsLclEnv)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
-&gt; Module
-&gt; GlobalRdrEnv
-&gt; TypeEnv
-&gt; FamInstEnv
-&gt; TcRef Messages
-&gt; IORef CostCentreState
-&gt; [CompleteMatch]
-&gt; (DsGblEnv, DsLclEnv)
</span><a href="GHC.HsToCore.Monad.html#mkDsEnvs"><span class="hs-identifier hs-var">mkDsEnvs</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681140250"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681140248"><span class="hs-identifier hs-var">this_mod</span></a></span><span> </span><span class="annot"><span class="annottext">GlobalRdrEnv
</span><a href="#local-6989586621681140244"><span class="hs-identifier hs-var">rdr_env</span></a></span><span> </span><span class="annot"><span class="annottext">TypeEnv
</span><a href="#local-6989586621681140246"><span class="hs-identifier hs-var">type_env</span></a></span><span> </span><span class="annot"><span class="annottext">FamInstEnv
</span><a href="#local-6989586621681140242"><span class="hs-identifier hs-var">fam_inst_env</span></a></span><span>
</span><span id="line-219"></span><span>                           </span><span class="annot"><span class="annottext">TcRef Messages
</span><a href="#local-6989586621681140255"><span class="hs-identifier hs-var">msg_var</span></a></span><span> </span><span class="annot"><span class="annottext">IORef CostCentreState
</span><a href="#local-6989586621681140253"><span class="hs-identifier hs-var">cc_st_var</span></a></span><span> </span><span class="annot"><span class="annottext">[CompleteMatch]
</span><a href="#local-6989586621681140240"><span class="hs-identifier hs-var">complete_matches</span></a></span><span>
</span><span id="line-220"></span><span>       </span><span class="hs-special">}</span><span>
</span><span id="line-221"></span><span>
</span><span id="line-222"></span><span id="local-6989586621681140662"><span class="annot"><a href="GHC.HsToCore.Monad.html#runDs"><span class="hs-identifier hs-type">runDs</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Types.html#HscEnv"><span class="hs-identifier hs-type">HscEnv</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.html#DsGblEnv"><span class="hs-identifier hs-type">DsGblEnv</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#DsLclEnv"><span class="hs-identifier hs-type">DsLclEnv</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#DsM"><span class="hs-identifier hs-type">DsM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681140662"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Utils.Error.html#Messages"><span class="hs-identifier hs-type">Messages</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681140662"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span></span><span>
</span><span id="line-223"></span><span id="runDs"><span class="annot"><span class="annottext">runDs :: forall a.
HscEnv -&gt; (DsGblEnv, DsLclEnv) -&gt; DsM a -&gt; IO (Messages, Maybe a)
</span><a href="GHC.HsToCore.Monad.html#runDs"><span class="hs-identifier hs-var hs-var">runDs</span></a></span></span><span> </span><span id="local-6989586621681140233"><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681140233"><span class="hs-identifier hs-var">hsc_env</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621681140232"><span class="annot"><span class="annottext">DsGblEnv
</span><a href="#local-6989586621681140232"><span class="hs-identifier hs-var">ds_gbl</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681140231"><span class="annot"><span class="annottext">DsLclEnv
</span><a href="#local-6989586621681140231"><span class="hs-identifier hs-var">ds_lcl</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621681140230"><span class="annot"><span class="annottext">DsM a
</span><a href="#local-6989586621681140230"><span class="hs-identifier hs-var">thing_inside</span></a></span></span><span>
</span><span id="line-224"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span id="local-6989586621681140229"><span class="annot"><span class="annottext">Either IOEnvFailure a
</span><a href="#local-6989586621681140229"><span class="hs-identifier hs-var">res</span></a></span></span><span>    </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Char
-&gt; HscEnv
-&gt; DsGblEnv
-&gt; DsLclEnv
-&gt; TcRnIf DsGblEnv DsLclEnv (Either IOEnvFailure a)
-&gt; IO (Either IOEnvFailure a)
forall gbl lcl a.
Char -&gt; HscEnv -&gt; gbl -&gt; lcl -&gt; TcRnIf gbl lcl a -&gt; IO a
</span><a href="GHC.Tc.Utils.Monad.html#initTcRnIf"><span class="hs-identifier hs-var">initTcRnIf</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'d'</span></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681140233"><span class="hs-identifier hs-var">hsc_env</span></a></span><span> </span><span class="annot"><span class="annottext">DsGblEnv
</span><a href="#local-6989586621681140232"><span class="hs-identifier hs-var">ds_gbl</span></a></span><span> </span><span class="annot"><span class="annottext">DsLclEnv
</span><a href="#local-6989586621681140231"><span class="hs-identifier hs-var">ds_lcl</span></a></span><span>
</span><span id="line-225"></span><span>                              </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DsM a -&gt; TcRnIf DsGblEnv DsLclEnv (Either IOEnvFailure a)
forall env r. IOEnv env r -&gt; IOEnv env (Either IOEnvFailure r)
</span><a href="GHC.Data.IOEnv.html#tryM"><span class="hs-identifier hs-var">tryM</span></a></span><span> </span><span class="annot"><span class="annottext">DsM a
</span><a href="#local-6989586621681140230"><span class="hs-identifier hs-var">thing_inside</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-226"></span><span>       </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681140226"><span class="annot"><span class="annottext">Messages
</span><a href="#local-6989586621681140226"><span class="hs-identifier hs-var">msgs</span></a></span></span><span>   </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TcRef Messages -&gt; IO Messages
forall a. IORef a -&gt; IO a
</span><a href="../../base/src/GHC.IORef.html#readIORef"><span class="hs-identifier hs-var">readIORef</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DsGblEnv -&gt; TcRef Messages
</span><a href="GHC.Tc.Types.html#ds_msgs"><span class="hs-identifier hs-var hs-var">ds_msgs</span></a></span><span> </span><span class="annot"><span class="annottext">DsGblEnv
</span><a href="#local-6989586621681140232"><span class="hs-identifier hs-var">ds_gbl</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-227"></span><span>       </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681140223"><span class="annot"><span class="annottext">final_res :: Maybe a
</span><a href="#local-6989586621681140223"><span class="hs-identifier hs-var hs-var">final_res</span></a></span></span><span>
</span><span id="line-228"></span><span>               </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; Messages -&gt; Bool
</span><a href="GHC.Utils.Error.html#errorsFound"><span class="hs-identifier hs-var">errorsFound</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681140221"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">Messages
</span><a href="#local-6989586621681140226"><span class="hs-identifier hs-var">msgs</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe a
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-229"></span><span>               </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/Data.Either.html#Right"><span class="hs-identifier hs-type">Right</span></a></span><span> </span><span id="local-6989586621681140220"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621681140220"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Either IOEnvFailure a
</span><a href="#local-6989586621681140229"><span class="hs-identifier hs-var">res</span></a></span><span>          </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; Maybe a
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621681140220"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-230"></span><span>               </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>               </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; Maybe a
forall a. String -&gt; a
</span><a href="GHC.Utils.Panic.Plain.html#panic"><span class="hs-identifier hs-var">panic</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;initDs&quot;</span></span><span>
</span><span id="line-231"></span><span>       </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">(Messages, Maybe a) -&gt; IO (Messages, Maybe a)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Messages
</span><a href="#local-6989586621681140226"><span class="hs-identifier hs-var">msgs</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Maybe a
</span><a href="#local-6989586621681140223"><span class="hs-identifier hs-var">final_res</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-232"></span><span>       </span><span class="hs-special">}</span><span>
</span><span id="line-233"></span><span>  </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621681140221"><span class="annot"><span class="annottext">dflags :: DynFlags
</span><a href="#local-6989586621681140221"><span class="hs-identifier hs-var hs-var">dflags</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HscEnv -&gt; DynFlags
</span><a href="GHC.Driver.Types.html#hsc_dflags"><span class="hs-identifier hs-var hs-var">hsc_dflags</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681140233"><span class="hs-identifier hs-var">hsc_env</span></a></span><span>
</span><span id="line-234"></span><span>
</span><span id="line-235"></span><span class="hs-comment">-- | Run a 'DsM' action in the context of an existing 'ModGuts'</span><span>
</span><span id="line-236"></span><span id="local-6989586621681140637"><span class="annot"><a href="GHC.HsToCore.Monad.html#initDsWithModGuts"><span class="hs-identifier hs-type">initDsWithModGuts</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Types.html#HscEnv"><span class="hs-identifier hs-type">HscEnv</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Driver.Types.html#ModGuts"><span class="hs-identifier hs-type">ModGuts</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#DsM"><span class="hs-identifier hs-type">DsM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681140637"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Utils.Error.html#Messages"><span class="hs-identifier hs-type">Messages</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681140637"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span></span><span>
</span><span id="line-237"></span><span id="initDsWithModGuts"><span class="annot"><span class="annottext">initDsWithModGuts :: forall a. HscEnv -&gt; ModGuts -&gt; DsM a -&gt; IO (Messages, Maybe a)
</span><a href="GHC.HsToCore.Monad.html#initDsWithModGuts"><span class="hs-identifier hs-var hs-var">initDsWithModGuts</span></a></span></span><span> </span><span id="local-6989586621681140216"><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681140216"><span class="hs-identifier hs-var">hsc_env</span></a></span></span><span> </span><span id="local-6989586621681140215"><span class="annot"><span class="annottext">ModGuts
</span><a href="#local-6989586621681140215"><span class="hs-identifier hs-var">guts</span></a></span></span><span> </span><span id="local-6989586621681140214"><span class="annot"><span class="annottext">DsM a
</span><a href="#local-6989586621681140214"><span class="hs-identifier hs-var">thing_inside</span></a></span></span><span>
</span><span id="line-238"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span id="local-6989586621681140213"><span class="annot"><span class="annottext">IORef CostCentreState
</span><a href="#local-6989586621681140213"><span class="hs-identifier hs-var">cc_st_var</span></a></span></span><span>   </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">CostCentreState -&gt; IO (IORef CostCentreState)
forall a. a -&gt; IO (IORef a)
</span><a href="../../base/src/GHC.IORef.html#newIORef"><span class="hs-identifier hs-var">newIORef</span></a></span><span> </span><span class="annot"><span class="annottext">CostCentreState
</span><a href="GHC.Types.CostCentre.State.html#newCostCentreState"><span class="hs-identifier hs-var">newCostCentreState</span></a></span><span>
</span><span id="line-239"></span><span>       </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681140212"><span class="annot"><span class="annottext">TcRef Messages
</span><a href="#local-6989586621681140212"><span class="hs-identifier hs-var">msg_var</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Messages -&gt; IO (TcRef Messages)
forall a. a -&gt; IO (IORef a)
</span><a href="../../base/src/GHC.IORef.html#newIORef"><span class="hs-identifier hs-var">newIORef</span></a></span><span> </span><span class="annot"><span class="annottext">Messages
</span><a href="GHC.Utils.Error.html#emptyMessages"><span class="hs-identifier hs-var">emptyMessages</span></a></span><span>
</span><span id="line-240"></span><span>       </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681140211"><span class="annot"><span class="annottext">dflags :: DynFlags
</span><a href="#local-6989586621681140211"><span class="hs-identifier hs-var hs-var">dflags</span></a></span></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HscEnv -&gt; DynFlags
</span><a href="GHC.Driver.Types.html#hsc_dflags"><span class="hs-identifier hs-var hs-var">hsc_dflags</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681140216"><span class="hs-identifier hs-var">hsc_env</span></a></span><span>
</span><span id="line-241"></span><span>             </span><span id="local-6989586621681140210"><span class="annot"><span class="annottext">type_env :: TypeEnv
</span><a href="#local-6989586621681140210"><span class="hs-identifier hs-var hs-var">type_env</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Id] -&gt; [TyCon] -&gt; [FamInst] -&gt; TypeEnv
</span><a href="GHC.Driver.Types.html#typeEnvFromEntities"><span class="hs-identifier hs-var">typeEnvFromEntities</span></a></span><span> </span><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621681140208"><span class="hs-identifier hs-var">ids</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ModGuts -&gt; [TyCon]
</span><a href="GHC.Driver.Types.html#mg_tcs"><span class="hs-identifier hs-var hs-var">mg_tcs</span></a></span><span> </span><span class="annot"><span class="annottext">ModGuts
</span><a href="#local-6989586621681140215"><span class="hs-identifier hs-var">guts</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ModGuts -&gt; [FamInst]
</span><a href="GHC.Driver.Types.html#mg_fam_insts"><span class="hs-identifier hs-var hs-var">mg_fam_insts</span></a></span><span> </span><span class="annot"><span class="annottext">ModGuts
</span><a href="#local-6989586621681140215"><span class="hs-identifier hs-var">guts</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-242"></span><span>             </span><span id="local-6989586621681140205"><span class="annot"><span class="annottext">rdr_env :: GlobalRdrEnv
</span><a href="#local-6989586621681140205"><span class="hs-identifier hs-var hs-var">rdr_env</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ModGuts -&gt; GlobalRdrEnv
</span><a href="GHC.Driver.Types.html#mg_rdr_env"><span class="hs-identifier hs-var hs-var">mg_rdr_env</span></a></span><span> </span><span class="annot"><span class="annottext">ModGuts
</span><a href="#local-6989586621681140215"><span class="hs-identifier hs-var">guts</span></a></span><span>
</span><span id="line-243"></span><span>             </span><span id="local-6989586621681140203"><span class="annot"><span class="annottext">fam_inst_env :: FamInstEnv
</span><a href="#local-6989586621681140203"><span class="hs-identifier hs-var hs-var">fam_inst_env</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ModGuts -&gt; FamInstEnv
</span><a href="GHC.Driver.Types.html#mg_fam_inst_env"><span class="hs-identifier hs-var hs-var">mg_fam_inst_env</span></a></span><span> </span><span class="annot"><span class="annottext">ModGuts
</span><a href="#local-6989586621681140215"><span class="hs-identifier hs-var">guts</span></a></span><span>
</span><span id="line-244"></span><span>             </span><span id="local-6989586621681140201"><span class="annot"><span class="annottext">this_mod :: Module
</span><a href="#local-6989586621681140201"><span class="hs-identifier hs-var hs-var">this_mod</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ModGuts -&gt; Module
</span><a href="GHC.Driver.Types.html#mg_module"><span class="hs-identifier hs-var hs-var">mg_module</span></a></span><span> </span><span class="annot"><span class="annottext">ModGuts
</span><a href="#local-6989586621681140215"><span class="hs-identifier hs-var">guts</span></a></span><span>
</span><span id="line-245"></span><span>             </span><span id="local-6989586621681140199"><span class="annot"><span class="annottext">complete_matches :: [CompleteMatch]
</span><a href="#local-6989586621681140199"><span class="hs-identifier hs-var hs-var">complete_matches</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HscEnv -&gt; [CompleteMatch]
</span><a href="GHC.Driver.Types.html#hptCompleteSigs"><span class="hs-identifier hs-var">hptCompleteSigs</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681140216"><span class="hs-identifier hs-var">hsc_env</span></a></span><span>
</span><span id="line-246"></span><span>                                </span><span class="annot"><span class="annottext">[CompleteMatch] -&gt; [CompleteMatch] -&gt; [CompleteMatch]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">ModGuts -&gt; [CompleteMatch]
</span><a href="GHC.Driver.Types.html#mg_complete_sigs"><span class="hs-identifier hs-var hs-var">mg_complete_sigs</span></a></span><span> </span><span class="annot"><span class="annottext">ModGuts
</span><a href="#local-6989586621681140215"><span class="hs-identifier hs-var">guts</span></a></span><span>
</span><span id="line-247"></span><span>
</span><span id="line-248"></span><span>             </span><span id="local-6989586621681140197"><span class="annot"><span class="annottext">bindsToIds :: Bind b -&gt; [b]
</span><a href="#local-6989586621681140197"><span class="hs-identifier hs-var hs-var">bindsToIds</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.html#NonRec"><span class="hs-identifier hs-type">NonRec</span></a></span><span> </span><span id="local-6989586621681140195"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621681140195"><span class="hs-identifier hs-var">v</span></a></span></span><span> </span><span class="annot"><span class="annottext">Expr b
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621681140195"><span class="hs-identifier hs-var">v</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-249"></span><span>             </span><span class="annot"><a href="#local-6989586621681140197"><span class="hs-identifier hs-var">bindsToIds</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.html#Rec"><span class="hs-identifier hs-type">Rec</span></a></span><span>    </span><span id="local-6989586621681140193"><span class="annot"><span class="annottext">[(b, Expr b)]
</span><a href="#local-6989586621681140193"><span class="hs-identifier hs-var">binds</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">((b, Expr b) -&gt; b) -&gt; [(b, Expr b)] -&gt; [b]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">(b, Expr b) -&gt; b
forall a b. (a, b) -&gt; a
</span><a href="../../base/src/Data.Tuple.html#fst"><span class="hs-identifier hs-var">fst</span></a></span><span> </span><span class="annot"><span class="annottext">[(b, Expr b)]
</span><a href="#local-6989586621681140193"><span class="hs-identifier hs-var">binds</span></a></span><span>
</span><span id="line-250"></span><span>             </span><span id="local-6989586621681140208"><span class="annot"><span class="annottext">ids :: [Id]
</span><a href="#local-6989586621681140208"><span class="hs-identifier hs-var hs-var">ids</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Bind Id -&gt; [Id]) -&gt; [Bind Id] -&gt; [Id]
forall (t :: * -&gt; *) a b. Foldable t =&gt; (a -&gt; [b]) -&gt; t a -&gt; [b]
</span><a href="../../base/src/Data.Foldable.html#concatMap"><span class="hs-identifier hs-var">concatMap</span></a></span><span> </span><span class="annot"><span class="annottext">Bind Id -&gt; [Id]
forall {b}. Bind b -&gt; [b]
</span><a href="#local-6989586621681140197"><span class="hs-identifier hs-var">bindsToIds</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ModGuts -&gt; [Bind Id]
</span><a href="GHC.Driver.Types.html#mg_binds"><span class="hs-identifier hs-var hs-var">mg_binds</span></a></span><span> </span><span class="annot"><span class="annottext">ModGuts
</span><a href="#local-6989586621681140215"><span class="hs-identifier hs-var">guts</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-251"></span><span>
</span><span id="line-252"></span><span>             </span><span id="local-6989586621681140188"><span class="annot"><span class="annottext">envs :: (DsGblEnv, DsLclEnv)
</span><a href="#local-6989586621681140188"><span class="hs-identifier hs-var hs-var">envs</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DynFlags
-&gt; Module
-&gt; GlobalRdrEnv
-&gt; TypeEnv
-&gt; FamInstEnv
-&gt; TcRef Messages
-&gt; IORef CostCentreState
-&gt; [CompleteMatch]
-&gt; (DsGblEnv, DsLclEnv)
</span><a href="GHC.HsToCore.Monad.html#mkDsEnvs"><span class="hs-identifier hs-var">mkDsEnvs</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681140211"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681140201"><span class="hs-identifier hs-var">this_mod</span></a></span><span> </span><span class="annot"><span class="annottext">GlobalRdrEnv
</span><a href="#local-6989586621681140205"><span class="hs-identifier hs-var">rdr_env</span></a></span><span> </span><span class="annot"><span class="annottext">TypeEnv
</span><a href="#local-6989586621681140210"><span class="hs-identifier hs-var">type_env</span></a></span><span>
</span><span id="line-253"></span><span>                              </span><span class="annot"><span class="annottext">FamInstEnv
</span><a href="#local-6989586621681140203"><span class="hs-identifier hs-var">fam_inst_env</span></a></span><span> </span><span class="annot"><span class="annottext">TcRef Messages
</span><a href="#local-6989586621681140212"><span class="hs-identifier hs-var">msg_var</span></a></span><span> </span><span class="annot"><span class="annottext">IORef CostCentreState
</span><a href="#local-6989586621681140213"><span class="hs-identifier hs-var">cc_st_var</span></a></span><span>
</span><span id="line-254"></span><span>                              </span><span class="annot"><span class="annottext">[CompleteMatch]
</span><a href="#local-6989586621681140199"><span class="hs-identifier hs-var">complete_matches</span></a></span><span>
</span><span id="line-255"></span><span>       </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">HscEnv -&gt; (DsGblEnv, DsLclEnv) -&gt; DsM a -&gt; IO (Messages, Maybe a)
forall a.
HscEnv -&gt; (DsGblEnv, DsLclEnv) -&gt; DsM a -&gt; IO (Messages, Maybe a)
</span><a href="GHC.HsToCore.Monad.html#runDs"><span class="hs-identifier hs-var">runDs</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681140216"><span class="hs-identifier hs-var">hsc_env</span></a></span><span> </span><span class="annot"><span class="annottext">(DsGblEnv, DsLclEnv)
</span><a href="#local-6989586621681140188"><span class="hs-identifier hs-var">envs</span></a></span><span> </span><span class="annot"><span class="annottext">DsM a
</span><a href="#local-6989586621681140214"><span class="hs-identifier hs-var">thing_inside</span></a></span><span>
</span><span id="line-256"></span><span>       </span><span class="hs-special">}</span><span>
</span><span id="line-257"></span><span>
</span><span id="line-258"></span><span id="local-6989586621681140623"><span class="annot"><a href="GHC.HsToCore.Monad.html#initTcDsForSolver"><span class="hs-identifier hs-type">initTcDsForSolver</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcM"><span class="hs-identifier hs-type">TcM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681140623"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#DsM"><span class="hs-identifier hs-type">DsM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Utils.Error.html#Messages"><span class="hs-identifier hs-type">Messages</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681140623"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span></span><span>
</span><span id="line-259"></span><span class="hs-comment">-- Spin up a TcM context so that we can run the constraint solver</span><span>
</span><span id="line-260"></span><span class="hs-comment">-- Returns any error messages generated by the constraint solver</span><span>
</span><span id="line-261"></span><span class="hs-comment">-- and (Just res) if no error happened; Nothing if an error happened</span><span>
</span><span id="line-262"></span><span class="hs-comment">--</span><span>
</span><span id="line-263"></span><span class="hs-comment">-- Simon says: I'm not very happy about this.  We spin up a complete TcM monad</span><span>
</span><span id="line-264"></span><span class="hs-comment">--             only to immediately refine it to a TcS monad.</span><span>
</span><span id="line-265"></span><span class="hs-comment">-- Better perhaps to make TcS into its own monad, rather than building on TcS</span><span>
</span><span id="line-266"></span><span class="hs-comment">-- But that may in turn interact with plugins</span><span>
</span><span id="line-267"></span><span>
</span><span id="line-268"></span><span id="initTcDsForSolver"><span class="annot"><span class="annottext">initTcDsForSolver :: forall a. TcM a -&gt; DsM (Messages, Maybe a)
</span><a href="GHC.HsToCore.Monad.html#initTcDsForSolver"><span class="hs-identifier hs-var hs-var">initTcDsForSolver</span></a></span></span><span> </span><span id="local-6989586621681140184"><span class="annot"><span class="annottext">TcM a
</span><a href="#local-6989586621681140184"><span class="hs-identifier hs-var">thing_inside</span></a></span></span><span>
</span><span id="line-269"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681140183"><span class="annot"><span class="annottext">DsGblEnv
</span><a href="#local-6989586621681140183"><span class="hs-identifier hs-var">gbl</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681140182"><span class="annot"><span class="annottext">DsLclEnv
</span><a href="#local-6989586621681140182"><span class="hs-identifier hs-var">lcl</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TcRnIf DsGblEnv DsLclEnv (DsGblEnv, DsLclEnv)
forall gbl lcl. TcRnIf gbl lcl (gbl, lcl)
</span><a href="GHC.Tc.Utils.Monad.html#getEnvs"><span class="hs-identifier hs-var">getEnvs</span></a></span><span>
</span><span id="line-270"></span><span>       </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681140180"><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681140180"><span class="hs-identifier hs-var">hsc_env</span></a></span></span><span>    </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TcRnIf DsGblEnv DsLclEnv HscEnv
forall gbl lcl. TcRnIf gbl lcl HscEnv
</span><a href="GHC.Tc.Utils.Monad.html#getTopEnv"><span class="hs-identifier hs-var">getTopEnv</span></a></span><span>
</span><span id="line-271"></span><span>
</span><span id="line-272"></span><span>       </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#DsGblEnv"><span class="hs-identifier hs-type">DsGblEnv</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">ds_mod :: DsGblEnv -&gt; Module
</span><a href="GHC.Tc.Types.html#ds_mod"><span class="hs-identifier hs-var">ds_mod</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681140177"><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681140177"><span class="hs-identifier hs-var">mod</span></a></span></span><span>
</span><span id="line-273"></span><span>                      </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ds_fam_inst_env :: DsGblEnv -&gt; FamInstEnv
</span><a href="GHC.Tc.Types.html#ds_fam_inst_env"><span class="hs-identifier hs-var">ds_fam_inst_env</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681140175"><span class="annot"><span class="annottext">FamInstEnv
</span><a href="#local-6989586621681140175"><span class="hs-identifier hs-var">fam_inst_env</span></a></span></span><span> </span><span class="hs-special">}</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DsGblEnv
</span><a href="#local-6989586621681140183"><span class="hs-identifier hs-var">gbl</span></a></span><span>
</span><span id="line-274"></span><span>
</span><span id="line-275"></span><span>             </span><span class="annot"><a href="GHC.Tc.Types.html#DsLclEnv"><span class="hs-identifier hs-type">DsLclEnv</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">dsl_loc :: DsLclEnv -&gt; RealSrcSpan
</span><a href="GHC.Tc.Types.html#dsl_loc"><span class="hs-identifier hs-var">dsl_loc</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681140172"><span class="annot"><span class="annottext">RealSrcSpan
</span><a href="#local-6989586621681140172"><span class="hs-identifier hs-var">loc</span></a></span></span><span> </span><span class="hs-special">}</span><span>                  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DsLclEnv
</span><a href="#local-6989586621681140182"><span class="hs-identifier hs-var">lcl</span></a></span><span>
</span><span id="line-276"></span><span>
</span><span id="line-277"></span><span>       </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">IO (Messages, Maybe a) -&gt; DsM (Messages, Maybe a)
forall (m :: * -&gt; *) a. MonadIO m =&gt; IO a -&gt; m a
</span><a href="../../base/src/Control.Monad.IO.Class.html#liftIO"><span class="hs-identifier hs-var">liftIO</span></a></span><span> </span><span class="annot"><span class="annottext">(IO (Messages, Maybe a) -&gt; DsM (Messages, Maybe a))
-&gt; IO (Messages, Maybe a) -&gt; DsM (Messages, Maybe a)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
-&gt; HscSource
-&gt; Bool
-&gt; Module
-&gt; RealSrcSpan
-&gt; TcM a
-&gt; IO (Messages, Maybe a)
forall r.
HscEnv
-&gt; HscSource
-&gt; Bool
-&gt; Module
-&gt; RealSrcSpan
-&gt; TcM r
-&gt; IO (Messages, Maybe r)
</span><a href="GHC.Tc.Utils.Monad.html#initTc"><span class="hs-identifier hs-var">initTc</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681140180"><span class="hs-identifier hs-var">hsc_env</span></a></span><span> </span><span class="annot"><span class="annottext">HscSource
</span><a href="GHC.Driver.Phases.html#HsSrcFile"><span class="hs-identifier hs-var">HsSrcFile</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span> </span><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681140177"><span class="hs-identifier hs-var">mod</span></a></span><span> </span><span class="annot"><span class="annottext">RealSrcSpan
</span><a href="#local-6989586621681140172"><span class="hs-identifier hs-var">loc</span></a></span><span> </span><span class="annot"><span class="annottext">(TcM a -&gt; IO (Messages, Maybe a))
-&gt; TcM a -&gt; IO (Messages, Maybe a)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-278"></span><span>         </span><span class="annot"><span class="annottext">(TcGblEnv -&gt; TcGblEnv) -&gt; TcM a -&gt; TcM a
forall gbl lcl a.
(gbl -&gt; gbl) -&gt; TcRnIf gbl lcl a -&gt; TcRnIf gbl lcl a
</span><a href="GHC.Tc.Utils.Monad.html#updGblEnv"><span class="hs-identifier hs-var">updGblEnv</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span id="local-6989586621681140168"><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681140168"><span class="hs-identifier hs-var">tc_gbl</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681140168"><span class="hs-identifier hs-var">tc_gbl</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">tcg_fam_inst_env :: FamInstEnv
</span><a href="GHC.Tc.Types.html#tcg_fam_inst_env"><span class="hs-identifier hs-var">tcg_fam_inst_env</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">FamInstEnv
</span><a href="#local-6989586621681140175"><span class="hs-identifier hs-var">fam_inst_env</span></a></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(TcM a -&gt; TcM a) -&gt; TcM a -&gt; TcM a
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-279"></span><span>         </span><span class="annot"><span class="annottext">TcM a
</span><a href="#local-6989586621681140184"><span class="hs-identifier hs-var">thing_inside</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-280"></span><span>
</span><span id="line-281"></span><span class="annot"><a href="GHC.HsToCore.Monad.html#mkDsEnvs"><span class="hs-identifier hs-type">mkDsEnvs</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html#DynFlags"><span class="hs-identifier hs-type">DynFlags</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Unit.Types.html#Module"><span class="hs-identifier hs-type">Module</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Name.Reader.html#GlobalRdrEnv"><span class="hs-identifier hs-type">GlobalRdrEnv</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Driver.Types.html#TypeEnv"><span class="hs-identifier hs-type">TypeEnv</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.FamInstEnv.html#FamInstEnv"><span class="hs-identifier hs-type">FamInstEnv</span></a></span><span>
</span><span id="line-282"></span><span>         </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.IORef.html#IORef"><span class="hs-identifier hs-type">IORef</span></a></span><span> </span><span class="annot"><a href="GHC.Utils.Error.html#Messages"><span class="hs-identifier hs-type">Messages</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.IORef.html#IORef"><span class="hs-identifier hs-type">IORef</span></a></span><span> </span><span class="annot"><a href="GHC.Types.CostCentre.State.html#CostCentreState"><span class="hs-identifier hs-type">CostCentreState</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Driver.Types.html#CompleteMatch"><span class="hs-identifier hs-type">CompleteMatch</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-283"></span><span>         </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.html#DsGblEnv"><span class="hs-identifier hs-type">DsGblEnv</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#DsLclEnv"><span class="hs-identifier hs-type">DsLclEnv</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-284"></span><span id="mkDsEnvs"><span class="annot"><span class="annottext">mkDsEnvs :: DynFlags
-&gt; Module
-&gt; GlobalRdrEnv
-&gt; TypeEnv
-&gt; FamInstEnv
-&gt; TcRef Messages
-&gt; IORef CostCentreState
-&gt; [CompleteMatch]
-&gt; (DsGblEnv, DsLclEnv)
</span><a href="GHC.HsToCore.Monad.html#mkDsEnvs"><span class="hs-identifier hs-var hs-var">mkDsEnvs</span></a></span></span><span> </span><span id="local-6989586621681140167"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681140167"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span id="local-6989586621681140166"><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681140166"><span class="hs-identifier hs-var">mod</span></a></span></span><span> </span><span id="local-6989586621681140165"><span class="annot"><span class="annottext">GlobalRdrEnv
</span><a href="#local-6989586621681140165"><span class="hs-identifier hs-var">rdr_env</span></a></span></span><span> </span><span id="local-6989586621681140164"><span class="annot"><span class="annottext">TypeEnv
</span><a href="#local-6989586621681140164"><span class="hs-identifier hs-var">type_env</span></a></span></span><span> </span><span id="local-6989586621681140163"><span class="annot"><span class="annottext">FamInstEnv
</span><a href="#local-6989586621681140163"><span class="hs-identifier hs-var">fam_inst_env</span></a></span></span><span> </span><span id="local-6989586621681140162"><span class="annot"><span class="annottext">TcRef Messages
</span><a href="#local-6989586621681140162"><span class="hs-identifier hs-var">msg_var</span></a></span></span><span> </span><span id="local-6989586621681140161"><span class="annot"><span class="annottext">IORef CostCentreState
</span><a href="#local-6989586621681140161"><span class="hs-identifier hs-var">cc_st_var</span></a></span></span><span>
</span><span id="line-285"></span><span>         </span><span id="local-6989586621681140160"><span class="annot"><span class="annottext">[CompleteMatch]
</span><a href="#local-6989586621681140160"><span class="hs-identifier hs-var">complete_matches</span></a></span></span><span>
</span><span id="line-286"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681140158"><span class="annot"><span class="annottext">if_genv :: IfGblEnv
</span><a href="#local-6989586621681140158"><span class="hs-identifier hs-var hs-var">if_genv</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IfGblEnv :: SDoc -&gt; Maybe (Module, IfG TypeEnv) -&gt; IfGblEnv
</span><a href="GHC.Tc.Types.html#IfGblEnv"><span class="hs-identifier hs-type">IfGblEnv</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">if_doc :: SDoc
</span><a href="GHC.Tc.Types.html#if_doc"><span class="hs-identifier hs-var">if_doc</span></a></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;mkDsEnvs&quot;</span></span><span class="hs-special">,</span><span>
</span><span id="line-287"></span><span>                             </span><span class="annot"><span class="annottext">if_rec_types :: Maybe (Module, IfG TypeEnv)
</span><a href="GHC.Tc.Types.html#if_rec_types"><span class="hs-identifier hs-var">if_rec_types</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Module, IfG TypeEnv) -&gt; Maybe (Module, IfG TypeEnv)
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681140166"><span class="hs-identifier hs-var">mod</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">TypeEnv -&gt; IfG TypeEnv
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">TypeEnv
</span><a href="#local-6989586621681140164"><span class="hs-identifier hs-var">type_env</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-288"></span><span>        </span><span id="local-6989586621681140151"><span class="annot"><span class="annottext">if_lenv :: IfLclEnv
</span><a href="#local-6989586621681140151"><span class="hs-identifier hs-var hs-var">if_lenv</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Module -&gt; SDoc -&gt; IsBootInterface -&gt; IfLclEnv
</span><a href="GHC.Tc.Utils.Monad.html#mkIfLclEnv"><span class="hs-identifier hs-var">mkIfLclEnv</span></a></span><span> </span><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681140166"><span class="hs-identifier hs-var">mod</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;GHC error in desugarer lookup in&quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Module -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681140166"><span class="hs-identifier hs-var">mod</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-289"></span><span>                             </span><span class="annot"><span class="annottext">IsBootInterface
</span><a href="GHC.Unit.Types.html#NotBoot"><span class="hs-identifier hs-var">NotBoot</span></a></span><span>
</span><span id="line-290"></span><span>        </span><span id="local-6989586621681140148"><span class="annot"><span class="annottext">real_span :: RealSrcSpan
</span><a href="#local-6989586621681140148"><span class="hs-identifier hs-var hs-var">real_span</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">RealSrcLoc -&gt; RealSrcSpan
</span><a href="GHC.Types.SrcLoc.html#realSrcLocSpan"><span class="hs-identifier hs-var">realSrcLocSpan</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">FastString -&gt; Int -&gt; Int -&gt; RealSrcLoc
</span><a href="GHC.Types.SrcLoc.html#mkRealSrcLoc"><span class="hs-identifier hs-var">mkRealSrcLoc</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ModuleName -&gt; FastString
</span><a href="GHC.Unit.Module.Name.html#moduleNameFS"><span class="hs-identifier hs-var">moduleNameFS</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Module -&gt; ModuleName
forall unit. GenModule unit -&gt; ModuleName
</span><a href="GHC.Unit.Types.html#moduleName"><span class="hs-identifier hs-var hs-var">moduleName</span></a></span><span> </span><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681140166"><span class="hs-identifier hs-var">mod</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span>
</span><span id="line-291"></span><span>        </span><span id="local-6989586621681140143"><span class="annot"><span class="annottext">completeMatchMap :: CompleteMatchMap
</span><a href="#local-6989586621681140143"><span class="hs-identifier hs-var hs-var">completeMatchMap</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[CompleteMatch] -&gt; CompleteMatchMap
</span><a href="GHC.Driver.Types.html#mkCompleteMatchMap"><span class="hs-identifier hs-var">mkCompleteMatchMap</span></a></span><span> </span><span class="annot"><span class="annottext">[CompleteMatch]
</span><a href="#local-6989586621681140160"><span class="hs-identifier hs-var">complete_matches</span></a></span><span>
</span><span id="line-292"></span><span>        </span><span id="local-6989586621681140141"><span class="annot"><span class="annottext">gbl_env :: DsGblEnv
</span><a href="#local-6989586621681140141"><span class="hs-identifier hs-var hs-var">gbl_env</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DsGblEnv :: Module
-&gt; FamInstEnv
-&gt; PrintUnqualified
-&gt; TcRef Messages
-&gt; (IfGblEnv, IfLclEnv)
-&gt; CompleteMatchMap
-&gt; IORef CostCentreState
-&gt; DsGblEnv
</span><a href="GHC.Tc.Types.html#DsGblEnv"><span class="hs-identifier hs-type">DsGblEnv</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">ds_mod :: Module
</span><a href="GHC.Tc.Types.html#ds_mod"><span class="hs-identifier hs-var">ds_mod</span></a></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681140166"><span class="hs-identifier hs-var">mod</span></a></span><span>
</span><span id="line-293"></span><span>                           </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ds_fam_inst_env :: FamInstEnv
</span><a href="GHC.Tc.Types.html#ds_fam_inst_env"><span class="hs-identifier hs-var">ds_fam_inst_env</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">FamInstEnv
</span><a href="#local-6989586621681140163"><span class="hs-identifier hs-var">fam_inst_env</span></a></span><span>
</span><span id="line-294"></span><span>                           </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ds_if_env :: (IfGblEnv, IfLclEnv)
</span><a href="GHC.Tc.Types.html#ds_if_env"><span class="hs-identifier hs-var">ds_if_env</span></a></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">IfGblEnv
</span><a href="#local-6989586621681140158"><span class="hs-identifier hs-var">if_genv</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">IfLclEnv
</span><a href="#local-6989586621681140151"><span class="hs-identifier hs-var">if_lenv</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-295"></span><span>                           </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ds_unqual :: PrintUnqualified
</span><a href="GHC.Tc.Types.html#ds_unqual"><span class="hs-identifier hs-var">ds_unqual</span></a></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; GlobalRdrEnv -&gt; PrintUnqualified
</span><a href="GHC.Driver.Types.html#mkPrintUnqualified"><span class="hs-identifier hs-var">mkPrintUnqualified</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681140167"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">GlobalRdrEnv
</span><a href="#local-6989586621681140165"><span class="hs-identifier hs-var">rdr_env</span></a></span><span>
</span><span id="line-296"></span><span>                           </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ds_msgs :: TcRef Messages
</span><a href="GHC.Tc.Types.html#ds_msgs"><span class="hs-identifier hs-var">ds_msgs</span></a></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TcRef Messages
</span><a href="#local-6989586621681140162"><span class="hs-identifier hs-var">msg_var</span></a></span><span>
</span><span id="line-297"></span><span>                           </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ds_complete_matches :: CompleteMatchMap
</span><a href="GHC.Tc.Types.html#ds_complete_matches"><span class="hs-identifier hs-var">ds_complete_matches</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CompleteMatchMap
</span><a href="#local-6989586621681140143"><span class="hs-identifier hs-var">completeMatchMap</span></a></span><span>
</span><span id="line-298"></span><span>                           </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ds_cc_st :: IORef CostCentreState
</span><a href="GHC.Tc.Types.html#ds_cc_st"><span class="hs-identifier hs-var">ds_cc_st</span></a></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IORef CostCentreState
</span><a href="#local-6989586621681140161"><span class="hs-identifier hs-var">cc_st_var</span></a></span><span>
</span><span id="line-299"></span><span>                           </span><span class="hs-special">}</span><span>
</span><span id="line-300"></span><span>        </span><span id="local-6989586621681140135"><span class="annot"><span class="annottext">lcl_env :: DsLclEnv
</span><a href="#local-6989586621681140135"><span class="hs-identifier hs-var hs-var">lcl_env</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DsLclEnv :: DsMetaEnv -&gt; RealSrcSpan -&gt; Deltas -&gt; DsLclEnv
</span><a href="GHC.Tc.Types.html#DsLclEnv"><span class="hs-identifier hs-type">DsLclEnv</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">dsl_meta :: DsMetaEnv
</span><a href="GHC.Tc.Types.html#dsl_meta"><span class="hs-identifier hs-var">dsl_meta</span></a></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DsMetaEnv
forall a. NameEnv a
</span><a href="GHC.Types.Name.Env.html#emptyNameEnv"><span class="hs-identifier hs-var">emptyNameEnv</span></a></span><span>
</span><span id="line-301"></span><span>                           </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">dsl_loc :: RealSrcSpan
</span><a href="GHC.Tc.Types.html#dsl_loc"><span class="hs-identifier hs-var">dsl_loc</span></a></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">RealSrcSpan
</span><a href="#local-6989586621681140148"><span class="hs-identifier hs-var">real_span</span></a></span><span>
</span><span id="line-302"></span><span>                           </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">dsl_deltas :: Deltas
</span><a href="GHC.Tc.Types.html#dsl_deltas"><span class="hs-identifier hs-var">dsl_deltas</span></a></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Deltas
</span><a href="GHC.HsToCore.PmCheck.Types.html#initDeltas"><span class="hs-identifier hs-var">initDeltas</span></a></span><span>
</span><span id="line-303"></span><span>                           </span><span class="hs-special">}</span><span>
</span><span id="line-304"></span><span>    </span><span class="hs-keyword">in</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DsGblEnv
</span><a href="#local-6989586621681140141"><span class="hs-identifier hs-var">gbl_env</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">DsLclEnv
</span><a href="#local-6989586621681140135"><span class="hs-identifier hs-var">lcl_env</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-305"></span><span>
</span><span id="line-306"></span><span>
</span><span id="line-307"></span><span class="hs-comment">{-
************************************************************************
*                                                                      *
                Operations in the monad
*                                                                      *
************************************************************************

And all this mysterious stuff is so we can occasionally reach out and
grab one or more names.  @newLocalDs@ isn't exported---exported
functions are defined with it.  The difference in name-strings makes
it easier to read debugging output.

Note [Levity polymorphism checking]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
According to the &quot;Levity Polymorphism&quot; paper (PLDI '17), levity
polymorphism is forbidden in precisely two places: in the type of a bound
term-level argument and in the type of an argument to a function. The paper
explains it more fully, but briefly: expressions in these contexts need to be
stored in registers, and it's hard (read, impossible) to store something
that's levity polymorphic.

We cannot check for bad levity polymorphism conveniently in the type checker,
because we can't tell, a priori, which levity metavariables will be solved.
At one point, I (Richard) thought we could check in the zonker, but it's hard
to know where precisely are the abstracted variables and the arguments. So
we check in the desugarer, the only place where we can see the Core code and
still report respectable syntax to the user. This covers the vast majority
of cases; see calls to GHC.HsToCore.Monad.dsNoLevPoly and friends.

Levity polymorphism is also prohibited in the types of binders, and the
desugarer checks for this in GHC-generated Ids. (The zonker handles
the user-writted ids in zonkIdBndr.) This is done in newSysLocalDsNoLP.
The newSysLocalDs variant is used in the vast majority of cases where
the binder is obviously not levity polymorphic, omitting the check.
It would be nice to ASSERT that there is no levity polymorphism here,
but we can't, because of the fixM in GHC.HsToCore.Arrows. It's all OK, though:
Core Lint will catch an error here.

However, the desugarer is the wrong place for certain checks. In particular,
the desugarer can't report a sensible error message if an HsWrapper is malformed.
After all, GHC itself produced the HsWrapper. So we store some message text
in the appropriate HsWrappers (e.g. WpFun) that we can print out in the
desugarer.

There are a few more checks in places where Core is generated outside the
desugarer. For example, in datatype and class declarations, where levity
polymorphism is checked for during validity checking. It would be nice to
have one central place for all this, but that doesn't seem possible while
still reporting nice error messages.

-}</span><span>
</span><span id="line-358"></span><span>
</span><span id="line-359"></span><span class="hs-comment">-- Make a new Id with the same print name, but different type, and new unique</span><span>
</span><span id="line-360"></span><span class="annot"><a href="GHC.HsToCore.Monad.html#newUniqueId"><span class="hs-identifier hs-type">newUniqueId</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Mult"><span class="hs-identifier hs-type">Mult</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#DsM"><span class="hs-identifier hs-type">DsM</span></a></span><span> </span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span>
</span><span id="line-361"></span><span id="newUniqueId"><span class="annot"><span class="annottext">newUniqueId :: Id -&gt; Type -&gt; Type -&gt; DsM Id
</span><a href="GHC.HsToCore.Monad.html#newUniqueId"><span class="hs-identifier hs-var hs-var">newUniqueId</span></a></span></span><span> </span><span id="local-6989586621681140129"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681140129"><span class="hs-identifier hs-var">id</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">FastString -&gt; Type -&gt; Type -&gt; DsM Id
</span><a href="GHC.HsToCore.Monad.html#mk_local"><span class="hs-identifier hs-var">mk_local</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">OccName -&gt; FastString
</span><a href="GHC.Types.Name.Occurrence.html#occNameFS"><span class="hs-identifier hs-var hs-var">occNameFS</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Name -&gt; OccName
</span><a href="GHC.Types.Name.html#nameOccName"><span class="hs-identifier hs-var">nameOccName</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Id -&gt; Name
</span><a href="GHC.Types.Id.html#idName"><span class="hs-identifier hs-var">idName</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681140129"><span class="hs-identifier hs-var">id</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-362"></span><span>
</span><span id="line-363"></span><span class="annot"><a href="GHC.HsToCore.Monad.html#duplicateLocalDs"><span class="hs-identifier hs-type">duplicateLocalDs</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#DsM"><span class="hs-identifier hs-type">DsM</span></a></span><span> </span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span>
</span><span id="line-364"></span><span id="duplicateLocalDs"><span class="annot"><span class="annottext">duplicateLocalDs :: Id -&gt; DsM Id
</span><a href="GHC.HsToCore.Monad.html#duplicateLocalDs"><span class="hs-identifier hs-var hs-var">duplicateLocalDs</span></a></span></span><span> </span><span id="local-6989586621681140124"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681140124"><span class="hs-identifier hs-var">old_local</span></a></span></span><span>
</span><span id="line-365"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>  </span><span class="hs-special">{</span><span> </span><span id="local-6989586621681140123"><span class="annot"><span class="annottext">Unique
</span><a href="#local-6989586621681140123"><span class="hs-identifier hs-var">uniq</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TcRnIf DsGblEnv DsLclEnv Unique
forall gbl lcl. TcRnIf gbl lcl Unique
</span><a href="GHC.Tc.Utils.Monad.html#newUnique"><span class="hs-identifier hs-var">newUnique</span></a></span><span>
</span><span id="line-366"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">Id -&gt; DsM Id
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Id -&gt; Unique -&gt; Id
</span><a href="GHC.Types.Id.html#setIdUnique"><span class="hs-identifier hs-var">setIdUnique</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681140124"><span class="hs-identifier hs-var">old_local</span></a></span><span> </span><span class="annot"><span class="annottext">Unique
</span><a href="#local-6989586621681140123"><span class="hs-identifier hs-var">uniq</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-367"></span><span>
</span><span id="line-368"></span><span class="annot"><a href="GHC.HsToCore.Monad.html#newPredVarDs"><span class="hs-identifier hs-type">newPredVarDs</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#PredType"><span class="hs-identifier hs-type">PredType</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#DsM"><span class="hs-identifier hs-type">DsM</span></a></span><span> </span><span class="annot"><a href="GHC.Types.Var.html#Var"><span class="hs-identifier hs-type">Var</span></a></span><span>
</span><span id="line-369"></span><span id="newPredVarDs"><span class="annot"><span class="annottext">newPredVarDs :: Type -&gt; DsM Id
</span><a href="GHC.HsToCore.Monad.html#newPredVarDs"><span class="hs-identifier hs-var hs-var">newPredVarDs</span></a></span></span><span>
</span><span id="line-370"></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">FastString -&gt; Type -&gt; Type -&gt; DsM Id
forall (m :: * -&gt; *).
MonadUnique m =&gt;
FastString -&gt; Type -&gt; Type -&gt; m Id
</span><a href="GHC.Types.Id.html#mkSysLocalOrCoVarM"><span class="hs-identifier hs-var">mkSysLocalOrCoVarM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; FastString
</span><a href="GHC.Data.FastString.html#fsLit"><span class="hs-identifier hs-var">fsLit</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;ds&quot;</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="GHC.Core.Type.html#Many"><span class="hs-identifier hs-var">Many</span></a></span><span>  </span><span class="hs-comment">-- like newSysLocalDs, but we allow covars</span><span>
</span><span id="line-371"></span><span>
</span><span id="line-372"></span><span class="annot"><a href="GHC.HsToCore.Monad.html#newSysLocalDsNoLP"><span class="hs-identifier hs-type">newSysLocalDsNoLP</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.HsToCore.Monad.html#newSysLocalDs"><span class="hs-identifier hs-type">newSysLocalDs</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.HsToCore.Monad.html#newFailLocalDs"><span class="hs-identifier hs-type">newFailLocalDs</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Mult"><span class="hs-identifier hs-type">Mult</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#DsM"><span class="hs-identifier hs-type">DsM</span></a></span><span> </span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span>
</span><span id="line-373"></span><span id="newSysLocalDsNoLP"><span class="annot"><span class="annottext">newSysLocalDsNoLP :: Type -&gt; Type -&gt; DsM Id
</span><a href="GHC.HsToCore.Monad.html#newSysLocalDsNoLP"><span class="hs-identifier hs-var hs-var">newSysLocalDsNoLP</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">FastString -&gt; Type -&gt; Type -&gt; DsM Id
</span><a href="GHC.HsToCore.Monad.html#mk_local"><span class="hs-identifier hs-var">mk_local</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; FastString
</span><a href="GHC.Data.FastString.html#fsLit"><span class="hs-identifier hs-var">fsLit</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;ds&quot;</span></span><span class="hs-special">)</span><span>
</span><span id="line-374"></span><span>
</span><span id="line-375"></span><span class="hs-comment">-- this variant should be used when the caller can be sure that the variable type</span><span>
</span><span id="line-376"></span><span class="hs-comment">-- is not levity-polymorphic. It is necessary when the type is knot-tied because</span><span>
</span><span id="line-377"></span><span class="hs-comment">-- of the fixM used in GHC.HsToCore.Arrows. See Note [Levity polymorphism checking]</span><span>
</span><span id="line-378"></span><span id="newSysLocalDs"><span class="annot"><span class="annottext">newSysLocalDs :: Type -&gt; Type -&gt; DsM Id
</span><a href="GHC.HsToCore.Monad.html#newSysLocalDs"><span class="hs-identifier hs-var hs-var">newSysLocalDs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">FastString -&gt; Type -&gt; Type -&gt; DsM Id
forall (m :: * -&gt; *).
MonadUnique m =&gt;
FastString -&gt; Type -&gt; Type -&gt; m Id
</span><a href="GHC.Types.Id.html#mkSysLocalM"><span class="hs-identifier hs-var">mkSysLocalM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; FastString
</span><a href="GHC.Data.FastString.html#fsLit"><span class="hs-identifier hs-var">fsLit</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;ds&quot;</span></span><span class="hs-special">)</span><span>
</span><span id="line-379"></span><span id="newFailLocalDs"><span class="annot"><span class="annottext">newFailLocalDs :: Type -&gt; Type -&gt; DsM Id
</span><a href="GHC.HsToCore.Monad.html#newFailLocalDs"><span class="hs-identifier hs-var hs-var">newFailLocalDs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">FastString -&gt; Type -&gt; Type -&gt; DsM Id
forall (m :: * -&gt; *).
MonadUnique m =&gt;
FastString -&gt; Type -&gt; Type -&gt; m Id
</span><a href="GHC.Types.Id.html#mkSysLocalM"><span class="hs-identifier hs-var">mkSysLocalM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; FastString
</span><a href="GHC.Data.FastString.html#fsLit"><span class="hs-identifier hs-var">fsLit</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;fail&quot;</span></span><span class="hs-special">)</span><span>
</span><span id="line-380"></span><span>  </span><span class="hs-comment">-- the fail variable is used only in a situation where we can tell that</span><span>
</span><span id="line-381"></span><span>  </span><span class="hs-comment">-- levity-polymorphism is impossible.</span><span>
</span><span id="line-382"></span><span>
</span><span id="line-383"></span><span class="annot"><a href="GHC.HsToCore.Monad.html#newSysLocalsDsNoLP"><span class="hs-identifier hs-type">newSysLocalsDsNoLP</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.HsToCore.Monad.html#newSysLocalsDs"><span class="hs-identifier hs-type">newSysLocalsDs</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Scaled"><span class="hs-identifier hs-type">Scaled</span></a></span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#DsM"><span class="hs-identifier hs-type">DsM</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-384"></span><span id="newSysLocalsDsNoLP"><span class="annot"><span class="annottext">newSysLocalsDsNoLP :: [Scaled Type] -&gt; DsM [Id]
</span><a href="GHC.HsToCore.Monad.html#newSysLocalsDsNoLP"><span class="hs-identifier hs-var hs-var">newSysLocalsDsNoLP</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Scaled Type -&gt; DsM Id) -&gt; [Scaled Type] -&gt; DsM [Id]
forall (t :: * -&gt; *) (m :: * -&gt; *) a b.
(Traversable t, Monad m) =&gt;
(a -&gt; m b) -&gt; t a -&gt; m (t b)
</span><a href="../../base/src/Data.Traversable.html#mapM"><span class="hs-identifier hs-var">mapM</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Scaled"><span class="hs-identifier hs-type">Scaled</span></a></span><span> </span><span id="local-6989586621681140114"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681140114"><span class="hs-identifier hs-var">w</span></a></span></span><span> </span><span id="local-6989586621681140113"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681140113"><span class="hs-identifier hs-var">t</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Type -&gt; DsM Id
</span><a href="GHC.HsToCore.Monad.html#newSysLocalDsNoLP"><span class="hs-identifier hs-var">newSysLocalDsNoLP</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681140114"><span class="hs-identifier hs-var">w</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681140113"><span class="hs-identifier hs-var">t</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-385"></span><span id="newSysLocalsDs"><span class="annot"><span class="annottext">newSysLocalsDs :: [Scaled Type] -&gt; DsM [Id]
</span><a href="GHC.HsToCore.Monad.html#newSysLocalsDs"><span class="hs-identifier hs-var hs-var">newSysLocalsDs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Scaled Type -&gt; DsM Id) -&gt; [Scaled Type] -&gt; DsM [Id]
forall (t :: * -&gt; *) (m :: * -&gt; *) a b.
(Traversable t, Monad m) =&gt;
(a -&gt; m b) -&gt; t a -&gt; m (t b)
</span><a href="../../base/src/Data.Traversable.html#mapM"><span class="hs-identifier hs-var">mapM</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Scaled"><span class="hs-identifier hs-type">Scaled</span></a></span><span> </span><span id="local-6989586621681140112"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681140112"><span class="hs-identifier hs-var">w</span></a></span></span><span> </span><span id="local-6989586621681140111"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681140111"><span class="hs-identifier hs-var">t</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Type -&gt; DsM Id
</span><a href="GHC.HsToCore.Monad.html#newSysLocalDs"><span class="hs-identifier hs-var">newSysLocalDs</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681140112"><span class="hs-identifier hs-var">w</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681140111"><span class="hs-identifier hs-var">t</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-386"></span><span>
</span><span id="line-387"></span><span class="annot"><a href="GHC.HsToCore.Monad.html#mk_local"><span class="hs-identifier hs-type">mk_local</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Data.FastString.html#FastString"><span class="hs-identifier hs-type">FastString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Mult"><span class="hs-identifier hs-type">Mult</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#DsM"><span class="hs-identifier hs-type">DsM</span></a></span><span> </span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span>
</span><span id="line-388"></span><span id="mk_local"><span class="annot"><span class="annottext">mk_local :: FastString -&gt; Type -&gt; Type -&gt; DsM Id
</span><a href="GHC.HsToCore.Monad.html#mk_local"><span class="hs-identifier hs-var hs-var">mk_local</span></a></span></span><span> </span><span id="local-6989586621681140110"><span class="annot"><span class="annottext">FastString
</span><a href="#local-6989586621681140110"><span class="hs-identifier hs-var">fs</span></a></span></span><span> </span><span id="local-6989586621681140109"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681140109"><span class="hs-identifier hs-var">w</span></a></span></span><span> </span><span id="local-6989586621681140108"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681140108"><span class="hs-identifier hs-var">ty</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">Type -&gt; SDoc -&gt; DsM ()
</span><a href="GHC.HsToCore.Monad.html#dsNoLevPoly"><span class="hs-identifier hs-var">dsNoLevPoly</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681140108"><span class="hs-identifier hs-var">ty</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;When trying to create a variable of type:&quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span>
</span><span id="line-389"></span><span>                                        </span><span class="annot"><span class="annottext">Type -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681140108"><span class="hs-identifier hs-var">ty</span></a></span><span class="hs-special">)</span><span>  </span><span class="hs-comment">-- could improve the msg with another</span><span>
</span><span id="line-390"></span><span>                                                 </span><span class="hs-comment">-- parameter indicating context</span><span>
</span><span id="line-391"></span><span>                      </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">FastString -&gt; Type -&gt; Type -&gt; DsM Id
forall (m :: * -&gt; *).
MonadUnique m =&gt;
FastString -&gt; Type -&gt; Type -&gt; m Id
</span><a href="GHC.Types.Id.html#mkSysLocalOrCoVarM"><span class="hs-identifier hs-var">mkSysLocalOrCoVarM</span></a></span><span> </span><span class="annot"><span class="annottext">FastString
</span><a href="#local-6989586621681140110"><span class="hs-identifier hs-var">fs</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681140109"><span class="hs-identifier hs-var">w</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681140108"><span class="hs-identifier hs-var">ty</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-392"></span><span>
</span><span id="line-393"></span><span class="hs-comment">{-
We can also reach out and either set/grab location information from
the @SrcSpan@ being carried around.
-}</span><span>
</span><span id="line-397"></span><span>
</span><span id="line-398"></span><span class="annot"><a href="GHC.HsToCore.Monad.html#getGhcModeDs"><span class="hs-identifier hs-type">getGhcModeDs</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#DsM"><span class="hs-identifier hs-type">DsM</span></a></span><span> </span><span class="annot"><a href="GHC.Driver.Session.html#GhcMode"><span class="hs-identifier hs-type">GhcMode</span></a></span><span>
</span><span id="line-399"></span><span id="getGhcModeDs"><span class="annot"><span class="annottext">getGhcModeDs :: DsM GhcMode
</span><a href="GHC.HsToCore.Monad.html#getGhcModeDs"><span class="hs-identifier hs-var hs-var">getGhcModeDs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>  </span><span class="annot"><span class="annottext">IOEnv (Env DsGblEnv DsLclEnv) DynFlags
forall (m :: * -&gt; *). HasDynFlags m =&gt; m DynFlags
</span><a href="GHC.Driver.Session.html#getDynFlags"><span class="hs-identifier hs-var">getDynFlags</span></a></span><span> </span><span class="annot"><span class="annottext">IOEnv (Env DsGblEnv DsLclEnv) DynFlags
-&gt; (DynFlags -&gt; DsM GhcMode) -&gt; DsM GhcMode
forall (m :: * -&gt; *) a b. Monad m =&gt; m a -&gt; (a -&gt; m b) -&gt; m b
</span><a href="../../base/src/GHC.Base.html#%3E%3E%3D"><span class="hs-operator hs-var">&gt;&gt;=</span></a></span><span> </span><span class="annot"><span class="annottext">GhcMode -&gt; DsM GhcMode
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">(GhcMode -&gt; DsM GhcMode)
-&gt; (DynFlags -&gt; GhcMode) -&gt; DynFlags -&gt; DsM GhcMode
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; GhcMode
</span><a href="GHC.Driver.Session.html#ghcMode"><span class="hs-identifier hs-var hs-var">ghcMode</span></a></span><span>
</span><span id="line-400"></span><span>
</span><span id="line-401"></span><span class="hs-comment">-- | Get the current pattern match oracle state. See 'dsl_deltas'.</span><span>
</span><span id="line-402"></span><span class="annot"><a href="GHC.HsToCore.Monad.html#getPmDeltas"><span class="hs-identifier hs-type">getPmDeltas</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#DsM"><span class="hs-identifier hs-type">DsM</span></a></span><span> </span><span class="annot"><a href="GHC.HsToCore.PmCheck.Types.html#Deltas"><span class="hs-identifier hs-type">Deltas</span></a></span><span>
</span><span id="line-403"></span><span id="getPmDeltas"><span class="annot"><span class="annottext">getPmDeltas :: DsM Deltas
</span><a href="GHC.HsToCore.Monad.html#getPmDeltas"><span class="hs-identifier hs-var hs-var">getPmDeltas</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span id="local-6989586621681140104"><span class="annot"><span class="annottext">DsLclEnv
</span><a href="#local-6989586621681140104"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TcRnIf DsGblEnv DsLclEnv DsLclEnv
forall gbl lcl. TcRnIf gbl lcl lcl
</span><a href="GHC.Tc.Utils.Monad.html#getLclEnv"><span class="hs-identifier hs-var">getLclEnv</span></a></span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">Deltas -&gt; DsM Deltas
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DsLclEnv -&gt; Deltas
</span><a href="GHC.Tc.Types.html#dsl_deltas"><span class="hs-identifier hs-var hs-var">dsl_deltas</span></a></span><span> </span><span class="annot"><span class="annottext">DsLclEnv
</span><a href="#local-6989586621681140104"><span class="hs-identifier hs-var">env</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-404"></span><span>
</span><span id="line-405"></span><span class="hs-comment">-- | Set the pattern match oracle state within the scope of the given action.</span><span>
</span><span id="line-406"></span><span class="hs-comment">-- See 'dsl_deltas'.</span><span>
</span><span id="line-407"></span><span id="local-6989586621681140579"><span class="annot"><a href="GHC.HsToCore.Monad.html#updPmDeltas"><span class="hs-identifier hs-type">updPmDeltas</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.HsToCore.PmCheck.Types.html#Deltas"><span class="hs-identifier hs-type">Deltas</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#DsM"><span class="hs-identifier hs-type">DsM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681140579"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#DsM"><span class="hs-identifier hs-type">DsM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681140579"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-408"></span><span id="updPmDeltas"><span class="annot"><span class="annottext">updPmDeltas :: forall a. Deltas -&gt; DsM a -&gt; DsM a
</span><a href="GHC.HsToCore.Monad.html#updPmDeltas"><span class="hs-identifier hs-var hs-var">updPmDeltas</span></a></span></span><span> </span><span id="local-6989586621681140102"><span class="annot"><span class="annottext">Deltas
</span><a href="#local-6989586621681140102"><span class="hs-identifier hs-var">delta</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(DsLclEnv -&gt; DsLclEnv)
-&gt; TcRnIf DsGblEnv DsLclEnv a -&gt; TcRnIf DsGblEnv DsLclEnv a
forall lcl gbl a.
(lcl -&gt; lcl) -&gt; TcRnIf gbl lcl a -&gt; TcRnIf gbl lcl a
</span><a href="GHC.Tc.Utils.Monad.html#updLclEnv"><span class="hs-identifier hs-var">updLclEnv</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span id="local-6989586621681140100"><span class="annot"><span class="annottext">DsLclEnv
</span><a href="#local-6989586621681140100"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">DsLclEnv
</span><a href="#local-6989586621681140100"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">dsl_deltas :: Deltas
</span><a href="GHC.Tc.Types.html#dsl_deltas"><span class="hs-identifier hs-var">dsl_deltas</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Deltas
</span><a href="#local-6989586621681140102"><span class="hs-identifier hs-var">delta</span></a></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-409"></span><span>
</span><span id="line-410"></span><span class="annot"><a href="GHC.HsToCore.Monad.html#getSrcSpanDs"><span class="hs-identifier hs-type">getSrcSpanDs</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#DsM"><span class="hs-identifier hs-type">DsM</span></a></span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html#SrcSpan"><span class="hs-identifier hs-type">SrcSpan</span></a></span><span>
</span><span id="line-411"></span><span id="getSrcSpanDs"><span class="annot"><span class="annottext">getSrcSpanDs :: DsM SrcSpan
</span><a href="GHC.HsToCore.Monad.html#getSrcSpanDs"><span class="hs-identifier hs-var hs-var">getSrcSpanDs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span id="local-6989586621681140099"><span class="annot"><span class="annottext">DsLclEnv
</span><a href="#local-6989586621681140099"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TcRnIf DsGblEnv DsLclEnv DsLclEnv
forall gbl lcl. TcRnIf gbl lcl lcl
</span><a href="GHC.Tc.Utils.Monad.html#getLclEnv"><span class="hs-identifier hs-var">getLclEnv</span></a></span><span>
</span><span id="line-412"></span><span>                  </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">SrcSpan -&gt; DsM SrcSpan
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">RealSrcSpan -&gt; Maybe BufSpan -&gt; SrcSpan
</span><a href="GHC.Types.SrcLoc.html#RealSrcSpan"><span class="hs-identifier hs-var">RealSrcSpan</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DsLclEnv -&gt; RealSrcSpan
</span><a href="GHC.Tc.Types.html#dsl_loc"><span class="hs-identifier hs-var hs-var">dsl_loc</span></a></span><span> </span><span class="annot"><span class="annottext">DsLclEnv
</span><a href="#local-6989586621681140099"><span class="hs-identifier hs-var">env</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Maybe BufSpan
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-413"></span><span>
</span><span id="line-414"></span><span id="local-6989586621681140573"><span class="annot"><a href="GHC.HsToCore.Monad.html#putSrcSpanDs"><span class="hs-identifier hs-type">putSrcSpanDs</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html#SrcSpan"><span class="hs-identifier hs-type">SrcSpan</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#DsM"><span class="hs-identifier hs-type">DsM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681140573"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#DsM"><span class="hs-identifier hs-type">DsM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681140573"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-415"></span><span id="putSrcSpanDs"><span class="annot"><span class="annottext">putSrcSpanDs :: forall a. SrcSpan -&gt; DsM a -&gt; DsM a
</span><a href="GHC.HsToCore.Monad.html#putSrcSpanDs"><span class="hs-identifier hs-var hs-var">putSrcSpanDs</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#UnhelpfulSpan"><span class="hs-identifier hs-type">UnhelpfulSpan</span></a></span><span> </span><span class="hs-special">{</span><span class="hs-special">}</span><span class="hs-special">)</span><span> </span><span id="local-6989586621681140096"><span class="annot"><span class="annottext">DsM a
</span><a href="#local-6989586621681140096"><span class="hs-identifier hs-var">thing_inside</span></a></span></span><span>
</span><span id="line-416"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DsM a
</span><a href="#local-6989586621681140096"><span class="hs-identifier hs-var">thing_inside</span></a></span><span>
</span><span id="line-417"></span><span class="annot"><a href="GHC.HsToCore.Monad.html#putSrcSpanDs"><span class="hs-identifier hs-var">putSrcSpanDs</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#RealSrcSpan"><span class="hs-identifier hs-type">RealSrcSpan</span></a></span><span> </span><span id="local-6989586621681140095"><span class="annot"><span class="annottext">RealSrcSpan
</span><a href="#local-6989586621681140095"><span class="hs-identifier hs-var">real_span</span></a></span></span><span> </span><span class="annot"><span class="annottext">Maybe BufSpan
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621681140094"><span class="annot"><span class="annottext">DsM a
</span><a href="#local-6989586621681140094"><span class="hs-identifier hs-var">thing_inside</span></a></span></span><span>
</span><span id="line-418"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(DsLclEnv -&gt; DsLclEnv) -&gt; DsM a -&gt; DsM a
forall lcl gbl a.
(lcl -&gt; lcl) -&gt; TcRnIf gbl lcl a -&gt; TcRnIf gbl lcl a
</span><a href="GHC.Tc.Utils.Monad.html#updLclEnv"><span class="hs-identifier hs-var">updLclEnv</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span> </span><span id="local-6989586621681140093"><span class="annot"><span class="annottext">DsLclEnv
</span><a href="#local-6989586621681140093"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">DsLclEnv
</span><a href="#local-6989586621681140093"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="hs-special">{</span><span class="annot"><span class="annottext">dsl_loc :: RealSrcSpan
</span><a href="GHC.Tc.Types.html#dsl_loc"><span class="hs-identifier hs-var">dsl_loc</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">RealSrcSpan
</span><a href="#local-6989586621681140095"><span class="hs-identifier hs-var">real_span</span></a></span><span class="hs-special">}</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">DsM a
</span><a href="#local-6989586621681140094"><span class="hs-identifier hs-var">thing_inside</span></a></span><span>
</span><span id="line-419"></span><span>
</span><span id="line-420"></span><span class="hs-comment">-- | Emit a warning for the current source location</span><span>
</span><span id="line-421"></span><span class="hs-comment">-- NB: Warns whether or not -Wxyz is set</span><span>
</span><span id="line-422"></span><span class="annot"><a href="GHC.HsToCore.Monad.html#warnDs"><span class="hs-identifier hs-type">warnDs</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Flags.html#WarnReason"><span class="hs-identifier hs-type">WarnReason</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#SDoc"><span class="hs-identifier hs-type">SDoc</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#DsM"><span class="hs-identifier hs-type">DsM</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-423"></span><span id="warnDs"><span class="annot"><span class="annottext">warnDs :: WarnReason -&gt; SDoc -&gt; DsM ()
</span><a href="GHC.HsToCore.Monad.html#warnDs"><span class="hs-identifier hs-var hs-var">warnDs</span></a></span></span><span> </span><span id="local-6989586621681140092"><span class="annot"><span class="annottext">WarnReason
</span><a href="#local-6989586621681140092"><span class="hs-identifier hs-var">reason</span></a></span></span><span> </span><span id="local-6989586621681140091"><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621681140091"><span class="hs-identifier hs-var">warn</span></a></span></span><span>
</span><span id="line-424"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span id="local-6989586621681140090"><span class="annot"><span class="annottext">DsGblEnv
</span><a href="#local-6989586621681140090"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TcRnIf DsGblEnv DsLclEnv DsGblEnv
forall gbl lcl. TcRnIf gbl lcl gbl
</span><a href="GHC.Tc.Utils.Monad.html#getGblEnv"><span class="hs-identifier hs-var">getGblEnv</span></a></span><span>
</span><span id="line-425"></span><span>       </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681140089"><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681140089"><span class="hs-identifier hs-var">loc</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">DsM SrcSpan
</span><a href="GHC.HsToCore.Monad.html#getSrcSpanDs"><span class="hs-identifier hs-var">getSrcSpanDs</span></a></span><span>
</span><span id="line-426"></span><span>       </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681140088"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681140088"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">IOEnv (Env DsGblEnv DsLclEnv) DynFlags
forall (m :: * -&gt; *). HasDynFlags m =&gt; m DynFlags
</span><a href="GHC.Driver.Session.html#getDynFlags"><span class="hs-identifier hs-var">getDynFlags</span></a></span><span>
</span><span id="line-427"></span><span>       </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681140087"><span class="annot"><span class="annottext">msg :: ErrMsg
</span><a href="#local-6989586621681140087"><span class="hs-identifier hs-var hs-var">msg</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">WarnReason -&gt; ErrMsg -&gt; ErrMsg
</span><a href="GHC.Utils.Error.html#makeIntoWarning"><span class="hs-identifier hs-var">makeIntoWarning</span></a></span><span> </span><span class="annot"><span class="annottext">WarnReason
</span><a href="#local-6989586621681140092"><span class="hs-identifier hs-var">reason</span></a></span><span> </span><span class="annot"><span class="annottext">(ErrMsg -&gt; ErrMsg) -&gt; ErrMsg -&gt; ErrMsg
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-428"></span><span>                   </span><span class="annot"><span class="annottext">DynFlags -&gt; SrcSpan -&gt; PrintUnqualified -&gt; SDoc -&gt; ErrMsg
</span><a href="GHC.Utils.Error.html#mkWarnMsg"><span class="hs-identifier hs-var">mkWarnMsg</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681140088"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681140089"><span class="hs-identifier hs-var">loc</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DsGblEnv -&gt; PrintUnqualified
</span><a href="GHC.Tc.Types.html#ds_unqual"><span class="hs-identifier hs-var hs-var">ds_unqual</span></a></span><span> </span><span class="annot"><span class="annottext">DsGblEnv
</span><a href="#local-6989586621681140090"><span class="hs-identifier hs-var">env</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621681140091"><span class="hs-identifier hs-var">warn</span></a></span><span>
</span><span id="line-429"></span><span>       </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">TcRef Messages -&gt; (Messages -&gt; Messages) -&gt; DsM ()
forall a env. IORef a -&gt; (a -&gt; a) -&gt; IOEnv env ()
</span><a href="GHC.Data.IOEnv.html#updMutVar"><span class="hs-identifier hs-var">updMutVar</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DsGblEnv -&gt; TcRef Messages
</span><a href="GHC.Tc.Types.html#ds_msgs"><span class="hs-identifier hs-var hs-var">ds_msgs</span></a></span><span> </span><span class="annot"><span class="annottext">DsGblEnv
</span><a href="#local-6989586621681140090"><span class="hs-identifier hs-var">env</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681140083"><span class="annot"><span class="annottext">WarningMessages
</span><a href="#local-6989586621681140083"><span class="hs-identifier hs-var">w</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621681140082"><span class="annot"><span class="annottext">WarningMessages
</span><a href="#local-6989586621681140082"><span class="hs-identifier hs-var">e</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">WarningMessages
</span><a href="#local-6989586621681140083"><span class="hs-identifier hs-var">w</span></a></span><span> </span><span class="annot"><span class="annottext">WarningMessages -&gt; ErrMsg -&gt; WarningMessages
forall a. Bag a -&gt; a -&gt; Bag a
</span><a href="GHC.Data.Bag.html#snocBag"><span class="hs-operator hs-var">`snocBag`</span></a></span><span> </span><span class="annot"><span class="annottext">ErrMsg
</span><a href="#local-6989586621681140087"><span class="hs-identifier hs-var">msg</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">WarningMessages
</span><a href="#local-6989586621681140082"><span class="hs-identifier hs-var">e</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-430"></span><span>
</span><span id="line-431"></span><span class="hs-comment">-- | Emit a warning only if the correct WarnReason is set in the DynFlags</span><span>
</span><span id="line-432"></span><span class="annot"><a href="GHC.HsToCore.Monad.html#warnIfSetDs"><span class="hs-identifier hs-type">warnIfSetDs</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Flags.html#WarningFlag"><span class="hs-identifier hs-type">WarningFlag</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#SDoc"><span class="hs-identifier hs-type">SDoc</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#DsM"><span class="hs-identifier hs-type">DsM</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-433"></span><span id="warnIfSetDs"><span class="annot"><span class="annottext">warnIfSetDs :: WarningFlag -&gt; SDoc -&gt; DsM ()
</span><a href="GHC.HsToCore.Monad.html#warnIfSetDs"><span class="hs-identifier hs-var hs-var">warnIfSetDs</span></a></span></span><span> </span><span id="local-6989586621681140080"><span class="annot"><span class="annottext">WarningFlag
</span><a href="#local-6989586621681140080"><span class="hs-identifier hs-var">flag</span></a></span></span><span> </span><span id="local-6989586621681140079"><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621681140079"><span class="hs-identifier hs-var">warn</span></a></span></span><span>
</span><span id="line-434"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">WarningFlag -&gt; DsM () -&gt; DsM ()
forall gbl lcl.
WarningFlag -&gt; TcRnIf gbl lcl () -&gt; TcRnIf gbl lcl ()
</span><a href="GHC.Tc.Utils.Monad.html#whenWOptM"><span class="hs-identifier hs-var">whenWOptM</span></a></span><span> </span><span class="annot"><span class="annottext">WarningFlag
</span><a href="#local-6989586621681140080"><span class="hs-identifier hs-var">flag</span></a></span><span> </span><span class="annot"><span class="annottext">(DsM () -&gt; DsM ()) -&gt; DsM () -&gt; DsM ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-435"></span><span>    </span><span class="annot"><span class="annottext">WarnReason -&gt; SDoc -&gt; DsM ()
</span><a href="GHC.HsToCore.Monad.html#warnDs"><span class="hs-identifier hs-var">warnDs</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">WarningFlag -&gt; WarnReason
</span><a href="GHC.Driver.Flags.html#Reason"><span class="hs-identifier hs-var">Reason</span></a></span><span> </span><span class="annot"><span class="annottext">WarningFlag
</span><a href="#local-6989586621681140080"><span class="hs-identifier hs-var">flag</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621681140079"><span class="hs-identifier hs-var">warn</span></a></span><span>
</span><span id="line-436"></span><span>
</span><span id="line-437"></span><span class="annot"><a href="GHC.HsToCore.Monad.html#errDs"><span class="hs-identifier hs-type">errDs</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#SDoc"><span class="hs-identifier hs-type">SDoc</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#DsM"><span class="hs-identifier hs-type">DsM</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-438"></span><span id="errDs"><span class="annot"><span class="annottext">errDs :: SDoc -&gt; DsM ()
</span><a href="GHC.HsToCore.Monad.html#errDs"><span class="hs-identifier hs-var hs-var">errDs</span></a></span></span><span> </span><span id="local-6989586621681140076"><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621681140076"><span class="hs-identifier hs-var">err</span></a></span></span><span>
</span><span id="line-439"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>  </span><span class="hs-special">{</span><span> </span><span id="local-6989586621681140075"><span class="annot"><span class="annottext">DsGblEnv
</span><a href="#local-6989586621681140075"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TcRnIf DsGblEnv DsLclEnv DsGblEnv
forall gbl lcl. TcRnIf gbl lcl gbl
</span><a href="GHC.Tc.Utils.Monad.html#getGblEnv"><span class="hs-identifier hs-var">getGblEnv</span></a></span><span>
</span><span id="line-440"></span><span>        </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681140074"><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681140074"><span class="hs-identifier hs-var">loc</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">DsM SrcSpan
</span><a href="GHC.HsToCore.Monad.html#getSrcSpanDs"><span class="hs-identifier hs-var">getSrcSpanDs</span></a></span><span>
</span><span id="line-441"></span><span>        </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681140073"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681140073"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">IOEnv (Env DsGblEnv DsLclEnv) DynFlags
forall (m :: * -&gt; *). HasDynFlags m =&gt; m DynFlags
</span><a href="GHC.Driver.Session.html#getDynFlags"><span class="hs-identifier hs-var">getDynFlags</span></a></span><span>
</span><span id="line-442"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681140072"><span class="annot"><span class="annottext">msg :: ErrMsg
</span><a href="#local-6989586621681140072"><span class="hs-identifier hs-var hs-var">msg</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; SrcSpan -&gt; PrintUnqualified -&gt; SDoc -&gt; ErrMsg
</span><a href="GHC.Utils.Error.html#mkErrMsg"><span class="hs-identifier hs-var">mkErrMsg</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681140073"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681140074"><span class="hs-identifier hs-var">loc</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DsGblEnv -&gt; PrintUnqualified
</span><a href="GHC.Tc.Types.html#ds_unqual"><span class="hs-identifier hs-var hs-var">ds_unqual</span></a></span><span> </span><span class="annot"><span class="annottext">DsGblEnv
</span><a href="#local-6989586621681140075"><span class="hs-identifier hs-var">env</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621681140076"><span class="hs-identifier hs-var">err</span></a></span><span>
</span><span id="line-443"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">TcRef Messages -&gt; (Messages -&gt; Messages) -&gt; DsM ()
forall a env. IORef a -&gt; (a -&gt; a) -&gt; IOEnv env ()
</span><a href="GHC.Data.IOEnv.html#updMutVar"><span class="hs-identifier hs-var">updMutVar</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DsGblEnv -&gt; TcRef Messages
</span><a href="GHC.Tc.Types.html#ds_msgs"><span class="hs-identifier hs-var hs-var">ds_msgs</span></a></span><span> </span><span class="annot"><span class="annottext">DsGblEnv
</span><a href="#local-6989586621681140075"><span class="hs-identifier hs-var">env</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681140070"><span class="annot"><span class="annottext">WarningMessages
</span><a href="#local-6989586621681140070"><span class="hs-identifier hs-var">w</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621681140069"><span class="annot"><span class="annottext">WarningMessages
</span><a href="#local-6989586621681140069"><span class="hs-identifier hs-var">e</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">WarningMessages
</span><a href="#local-6989586621681140070"><span class="hs-identifier hs-var">w</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">WarningMessages
</span><a href="#local-6989586621681140069"><span class="hs-identifier hs-var">e</span></a></span><span> </span><span class="annot"><span class="annottext">WarningMessages -&gt; ErrMsg -&gt; WarningMessages
forall a. Bag a -&gt; a -&gt; Bag a
</span><a href="GHC.Data.Bag.html#snocBag"><span class="hs-operator hs-var">`snocBag`</span></a></span><span> </span><span class="annot"><span class="annottext">ErrMsg
</span><a href="#local-6989586621681140072"><span class="hs-identifier hs-var">msg</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-444"></span><span>
</span><span id="line-445"></span><span class="hs-comment">-- | Issue an error, but return the expression for (), so that we can continue</span><span>
</span><span id="line-446"></span><span class="hs-comment">-- reporting errors.</span><span>
</span><span id="line-447"></span><span class="annot"><a href="GHC.HsToCore.Monad.html#errDsCoreExpr"><span class="hs-identifier hs-type">errDsCoreExpr</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#SDoc"><span class="hs-identifier hs-type">SDoc</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#DsM"><span class="hs-identifier hs-type">DsM</span></a></span><span> </span><span class="annot"><a href="GHC.Core.html#CoreExpr"><span class="hs-identifier hs-type">CoreExpr</span></a></span><span>
</span><span id="line-448"></span><span id="errDsCoreExpr"><span class="annot"><span class="annottext">errDsCoreExpr :: SDoc -&gt; DsM CoreExpr
</span><a href="GHC.HsToCore.Monad.html#errDsCoreExpr"><span class="hs-identifier hs-var hs-var">errDsCoreExpr</span></a></span></span><span> </span><span id="local-6989586621681140068"><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621681140068"><span class="hs-identifier hs-var">err</span></a></span></span><span>
</span><span id="line-449"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; DsM ()
</span><a href="GHC.HsToCore.Monad.html#errDs"><span class="hs-identifier hs-var">errDs</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621681140068"><span class="hs-identifier hs-var">err</span></a></span><span>
</span><span id="line-450"></span><span>       </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">CoreExpr -&gt; DsM CoreExpr
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">CoreExpr
</span><a href="GHC.Core.Make.html#unitExpr"><span class="hs-identifier hs-var">unitExpr</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-451"></span><span>
</span><span id="line-452"></span><span id="local-6989586621681140561"><span class="annot"><a href="GHC.HsToCore.Monad.html#failWithDs"><span class="hs-identifier hs-type">failWithDs</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#SDoc"><span class="hs-identifier hs-type">SDoc</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#DsM"><span class="hs-identifier hs-type">DsM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681140561"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-453"></span><span id="failWithDs"><span class="annot"><span class="annottext">failWithDs :: forall a. SDoc -&gt; DsM a
</span><a href="GHC.HsToCore.Monad.html#failWithDs"><span class="hs-identifier hs-var hs-var">failWithDs</span></a></span></span><span> </span><span id="local-6989586621681140066"><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621681140066"><span class="hs-identifier hs-var">err</span></a></span></span><span>
</span><span id="line-454"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>  </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; DsM ()
</span><a href="GHC.HsToCore.Monad.html#errDs"><span class="hs-identifier hs-var">errDs</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621681140066"><span class="hs-identifier hs-var">err</span></a></span><span>
</span><span id="line-455"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">DsM a
forall env a. IOEnv env a
</span><a href="GHC.Data.IOEnv.html#failM"><span class="hs-identifier hs-var">failM</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-456"></span><span>
</span><span id="line-457"></span><span id="local-6989586621681140557"><span class="annot"><a href="GHC.HsToCore.Monad.html#failDs"><span class="hs-identifier hs-type">failDs</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#DsM"><span class="hs-identifier hs-type">DsM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681140557"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-458"></span><span id="failDs"><span class="annot"><span class="annottext">failDs :: forall a. DsM a
</span><a href="GHC.HsToCore.Monad.html#failDs"><span class="hs-identifier hs-var hs-var">failDs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IOEnv (Env DsGblEnv DsLclEnv) a
forall env a. IOEnv env a
</span><a href="GHC.Data.IOEnv.html#failM"><span class="hs-identifier hs-var">failM</span></a></span><span>
</span><span id="line-459"></span><span>
</span><span id="line-460"></span><span class="hs-comment">-- (askNoErrsDs m) runs m</span><span>
</span><span id="line-461"></span><span class="hs-comment">-- If m fails,</span><span>
</span><span id="line-462"></span><span class="hs-comment">--    then (askNoErrsDs m) fails</span><span>
</span><span id="line-463"></span><span class="hs-comment">-- If m succeeds with result r,</span><span>
</span><span id="line-464"></span><span class="hs-comment">--    then (askNoErrsDs m) succeeds with result (r, b),</span><span>
</span><span id="line-465"></span><span class="hs-comment">--         where b is True iff m generated no errors</span><span>
</span><span id="line-466"></span><span class="hs-comment">-- Regardless of success or failure,</span><span>
</span><span id="line-467"></span><span class="hs-comment">--   propagate any errors/warnings generated by m</span><span>
</span><span id="line-468"></span><span class="hs-comment">--</span><span>
</span><span id="line-469"></span><span class="hs-comment">-- c.f. GHC.Tc.Utils.Monad.askNoErrs</span><span>
</span><span id="line-470"></span><span id="local-6989586621681140555"><span class="annot"><a href="GHC.HsToCore.Monad.html#askNoErrsDs"><span class="hs-identifier hs-type">askNoErrsDs</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#DsM"><span class="hs-identifier hs-type">DsM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681140555"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#DsM"><span class="hs-identifier hs-type">DsM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621681140555"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span class="hs-special">)</span></span><span>
</span><span id="line-471"></span><span id="askNoErrsDs"><span class="annot"><span class="annottext">askNoErrsDs :: forall a. DsM a -&gt; DsM (a, Bool)
</span><a href="GHC.HsToCore.Monad.html#askNoErrsDs"><span class="hs-identifier hs-var hs-var">askNoErrsDs</span></a></span></span><span> </span><span id="local-6989586621681140056"><span class="annot"><span class="annottext">DsM a
</span><a href="#local-6989586621681140056"><span class="hs-identifier hs-var">thing_inside</span></a></span></span><span>
</span><span id="line-472"></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span id="local-6989586621681140055"><span class="annot"><span class="annottext">TcRef Messages
</span><a href="#local-6989586621681140055"><span class="hs-identifier hs-var">errs_var</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Messages -&gt; IOEnv (Env DsGblEnv DsLclEnv) (TcRef Messages)
forall a env. a -&gt; IOEnv env (IORef a)
</span><a href="GHC.Data.IOEnv.html#newMutVar"><span class="hs-identifier hs-var">newMutVar</span></a></span><span> </span><span class="annot"><span class="annottext">Messages
</span><a href="GHC.Utils.Error.html#emptyMessages"><span class="hs-identifier hs-var">emptyMessages</span></a></span><span>
</span><span id="line-473"></span><span>      </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681140053"><span class="annot"><span class="annottext">DsGblEnv
</span><a href="#local-6989586621681140053"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TcRnIf DsGblEnv DsLclEnv DsGblEnv
forall gbl lcl. TcRnIf gbl lcl gbl
</span><a href="GHC.Tc.Utils.Monad.html#getGblEnv"><span class="hs-identifier hs-var">getGblEnv</span></a></span><span>
</span><span id="line-474"></span><span>      </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681140052"><span class="annot"><span class="annottext">Either IOEnvFailure a
</span><a href="#local-6989586621681140052"><span class="hs-identifier hs-var">mb_res</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">DsM a -&gt; IOEnv (Env DsGblEnv DsLclEnv) (Either IOEnvFailure a)
forall env r. IOEnv env r -&gt; IOEnv env (Either IOEnvFailure r)
</span><a href="GHC.Data.IOEnv.html#tryM"><span class="hs-identifier hs-var">tryM</span></a></span><span> </span><span class="annot"><span class="annottext">(DsM a -&gt; IOEnv (Env DsGblEnv DsLclEnv) (Either IOEnvFailure a))
-&gt; DsM a -&gt; IOEnv (Env DsGblEnv DsLclEnv) (Either IOEnvFailure a)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>  </span><span class="hs-comment">-- Be careful to catch exceptions</span><span>
</span><span id="line-475"></span><span>                          </span><span class="hs-comment">-- so that we propagate errors correctly</span><span>
</span><span id="line-476"></span><span>                          </span><span class="hs-comment">-- (#13642)</span><span>
</span><span id="line-477"></span><span>                  </span><span class="annot"><span class="annottext">DsGblEnv -&gt; DsM a -&gt; DsM a
forall gbl lcl a. gbl -&gt; TcRnIf gbl lcl a -&gt; TcRnIf gbl lcl a
</span><a href="GHC.Tc.Utils.Monad.html#setGblEnv"><span class="hs-identifier hs-var">setGblEnv</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DsGblEnv
</span><a href="#local-6989586621681140053"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">ds_msgs :: TcRef Messages
</span><a href="GHC.Tc.Types.html#ds_msgs"><span class="hs-identifier hs-var">ds_msgs</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TcRef Messages
</span><a href="#local-6989586621681140055"><span class="hs-identifier hs-var">errs_var</span></a></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(DsM a -&gt; DsM a) -&gt; DsM a -&gt; DsM a
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-478"></span><span>                  </span><span class="annot"><span class="annottext">DsM a
</span><a href="#local-6989586621681140056"><span class="hs-identifier hs-var">thing_inside</span></a></span><span>
</span><span id="line-479"></span><span>
</span><span id="line-480"></span><span>      </span><span class="hs-comment">-- Propagate errors</span><span>
</span><span id="line-481"></span><span>      </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681140050"><span class="annot"><span class="annottext">msgs :: Messages
</span><a href="#local-6989586621681140050"><span class="hs-identifier hs-var">msgs</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span id="local-6989586621681140049"><span class="annot"><span class="annottext">WarningMessages
</span><a href="#local-6989586621681140049"><span class="hs-identifier hs-var">warns</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681140048"><span class="annot"><span class="annottext">WarningMessages
</span><a href="#local-6989586621681140048"><span class="hs-identifier hs-var">errs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TcRef Messages -&gt; IOEnv (Env DsGblEnv DsLclEnv) Messages
forall a env. IORef a -&gt; IOEnv env a
</span><a href="GHC.Data.IOEnv.html#readMutVar"><span class="hs-identifier hs-var">readMutVar</span></a></span><span> </span><span class="annot"><span class="annottext">TcRef Messages
</span><a href="#local-6989586621681140055"><span class="hs-identifier hs-var">errs_var</span></a></span><span>
</span><span id="line-482"></span><span>      </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">TcRef Messages -&gt; (Messages -&gt; Messages) -&gt; DsM ()
forall a env. IORef a -&gt; (a -&gt; a) -&gt; IOEnv env ()
</span><a href="GHC.Data.IOEnv.html#updMutVar"><span class="hs-identifier hs-var">updMutVar</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DsGblEnv -&gt; TcRef Messages
</span><a href="GHC.Tc.Types.html#ds_msgs"><span class="hs-identifier hs-var hs-var">ds_msgs</span></a></span><span> </span><span class="annot"><span class="annottext">DsGblEnv
</span><a href="#local-6989586621681140053"><span class="hs-identifier hs-var">env</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681140046"><span class="annot"><span class="annottext">WarningMessages
</span><a href="#local-6989586621681140046"><span class="hs-identifier hs-var">w</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621681140045"><span class="annot"><span class="annottext">WarningMessages
</span><a href="#local-6989586621681140045"><span class="hs-identifier hs-var">e</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">WarningMessages
</span><a href="#local-6989586621681140046"><span class="hs-identifier hs-var">w</span></a></span><span> </span><span class="annot"><span class="annottext">WarningMessages -&gt; WarningMessages -&gt; WarningMessages
forall a. Bag a -&gt; Bag a -&gt; Bag a
</span><a href="GHC.Data.Bag.html#unionBags"><span class="hs-operator hs-var">`unionBags`</span></a></span><span> </span><span class="annot"><span class="annottext">WarningMessages
</span><a href="#local-6989586621681140049"><span class="hs-identifier hs-var">warns</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">WarningMessages
</span><a href="#local-6989586621681140045"><span class="hs-identifier hs-var">e</span></a></span><span> </span><span class="annot"><span class="annottext">WarningMessages -&gt; WarningMessages -&gt; WarningMessages
forall a. Bag a -&gt; Bag a -&gt; Bag a
</span><a href="GHC.Data.Bag.html#unionBags"><span class="hs-operator hs-var">`unionBags`</span></a></span><span> </span><span class="annot"><span class="annottext">WarningMessages
</span><a href="#local-6989586621681140048"><span class="hs-identifier hs-var">errs</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-483"></span><span>
</span><span id="line-484"></span><span>      </span><span class="hs-comment">-- And return</span><span>
</span><span id="line-485"></span><span>      </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Either IOEnvFailure a
</span><a href="#local-6989586621681140052"><span class="hs-identifier hs-var">mb_res</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-486"></span><span>           </span><span class="annot"><a href="../../base/src/Data.Either.html#Left"><span class="hs-identifier hs-type">Left</span></a></span><span> </span><span class="annot"><span class="annottext">IOEnvFailure
</span><span class="hs-identifier">_</span></span><span>    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">DsM (a, Bool)
forall env a. IOEnv env a
</span><a href="GHC.Data.IOEnv.html#failM"><span class="hs-identifier hs-var">failM</span></a></span><span>
</span><span id="line-487"></span><span>           </span><span class="annot"><a href="../../base/src/Data.Either.html#Right"><span class="hs-identifier hs-type">Right</span></a></span><span> </span><span id="local-6989586621681140043"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621681140043"><span class="hs-identifier hs-var">res</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span id="local-6989586621681140042"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681140042"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">IOEnv (Env DsGblEnv DsLclEnv) DynFlags
forall (m :: * -&gt; *). HasDynFlags m =&gt; m DynFlags
</span><a href="GHC.Driver.Session.html#getDynFlags"><span class="hs-identifier hs-var">getDynFlags</span></a></span><span>
</span><span id="line-488"></span><span>                           </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681140041"><span class="annot"><span class="annottext">errs_found :: Bool
</span><a href="#local-6989586621681140041"><span class="hs-identifier hs-var hs-var">errs_found</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; Messages -&gt; Bool
</span><a href="GHC.Utils.Error.html#errorsFound"><span class="hs-identifier hs-var">errorsFound</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681140042"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">Messages
</span><a href="#local-6989586621681140050"><span class="hs-identifier hs-var">msgs</span></a></span><span>
</span><span id="line-489"></span><span>                           </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">(a, Bool) -&gt; DsM (a, Bool)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621681140043"><span class="hs-identifier hs-var">res</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681140041"><span class="hs-identifier hs-var">errs_found</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-490"></span><span>
</span><span id="line-491"></span><span class="annot"><a href="GHC.HsToCore.Monad.html#mkPrintUnqualifiedDs"><span class="hs-identifier hs-type">mkPrintUnqualifiedDs</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#DsM"><span class="hs-identifier hs-type">DsM</span></a></span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#PrintUnqualified"><span class="hs-identifier hs-type">PrintUnqualified</span></a></span><span>
</span><span id="line-492"></span><span id="mkPrintUnqualifiedDs"><span class="annot"><span class="annottext">mkPrintUnqualifiedDs :: DsM PrintUnqualified
</span><a href="GHC.HsToCore.Monad.html#mkPrintUnqualifiedDs"><span class="hs-identifier hs-var hs-var">mkPrintUnqualifiedDs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DsGblEnv -&gt; PrintUnqualified
</span><a href="GHC.Tc.Types.html#ds_unqual"><span class="hs-identifier hs-var hs-var">ds_unqual</span></a></span><span> </span><span class="annot"><span class="annottext">(DsGblEnv -&gt; PrintUnqualified)
-&gt; TcRnIf DsGblEnv DsLclEnv DsGblEnv -&gt; DsM PrintUnqualified
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/Data.Functor.html#%3C%24%3E"><span class="hs-operator hs-var">&lt;$&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">TcRnIf DsGblEnv DsLclEnv DsGblEnv
forall gbl lcl. TcRnIf gbl lcl gbl
</span><a href="GHC.Tc.Utils.Monad.html#getGblEnv"><span class="hs-identifier hs-var">getGblEnv</span></a></span><span>
</span><span id="line-493"></span><span>
</span><span id="line-494"></span><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621681140031"><span id="local-6989586621681140033"><span id="local-6989586621681140035"><span class="annot"><a href="GHC.Driver.Types.html#MonadThings"><span class="hs-identifier hs-type">MonadThings</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.IOEnv.html#IOEnv"><span class="hs-identifier hs-type">IOEnv</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.html#Env"><span class="hs-identifier hs-type">Env</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#DsGblEnv"><span class="hs-identifier hs-type">DsGblEnv</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#DsLclEnv"><span class="hs-identifier hs-type">DsLclEnv</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span></span></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-495"></span><span>    </span><span id="local-6989586621681140029"><span class="annot"><span class="annottext">lookupThing :: Name -&gt; IOEnv (Env DsGblEnv DsLclEnv) TyThing
</span><a href="GHC.Driver.Types.html#lookupThing"><span class="hs-identifier hs-var hs-var hs-var hs-var">lookupThing</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Name -&gt; IOEnv (Env DsGblEnv DsLclEnv) TyThing
</span><a href="GHC.HsToCore.Monad.html#dsLookupGlobal"><span class="hs-identifier hs-var">dsLookupGlobal</span></a></span><span>
</span><span id="line-496"></span><span>
</span><span id="line-497"></span><span class="annot"><a href="GHC.HsToCore.Monad.html#dsLookupGlobal"><span class="hs-identifier hs-type">dsLookupGlobal</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Name.html#Name"><span class="hs-identifier hs-type">Name</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#DsM"><span class="hs-identifier hs-type">DsM</span></a></span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#TyThing"><span class="hs-identifier hs-type">TyThing</span></a></span><span>
</span><span id="line-498"></span><span class="hs-comment">-- Very like GHC.Tc.Utils.Env.tcLookupGlobal</span><span>
</span><span id="line-499"></span><span id="dsLookupGlobal"><span class="annot"><span class="annottext">dsLookupGlobal :: Name -&gt; IOEnv (Env DsGblEnv DsLclEnv) TyThing
</span><a href="GHC.HsToCore.Monad.html#dsLookupGlobal"><span class="hs-identifier hs-var hs-var">dsLookupGlobal</span></a></span></span><span> </span><span id="local-6989586621681140027"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681140027"><span class="hs-identifier hs-var">name</span></a></span></span><span>
</span><span id="line-500"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>  </span><span class="hs-special">{</span><span> </span><span id="local-6989586621681140026"><span class="annot"><span class="annottext">DsGblEnv
</span><a href="#local-6989586621681140026"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TcRnIf DsGblEnv DsLclEnv DsGblEnv
forall gbl lcl. TcRnIf gbl lcl gbl
</span><a href="GHC.Tc.Utils.Monad.html#getGblEnv"><span class="hs-identifier hs-var">getGblEnv</span></a></span><span>
</span><span id="line-501"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">(IfGblEnv, IfLclEnv)
-&gt; TcRnIf IfGblEnv IfLclEnv TyThing
-&gt; IOEnv (Env DsGblEnv DsLclEnv) TyThing
forall gbl' lcl' a gbl lcl.
(gbl', lcl') -&gt; TcRnIf gbl' lcl' a -&gt; TcRnIf gbl lcl a
</span><a href="GHC.Tc.Utils.Monad.html#setEnvs"><span class="hs-identifier hs-var">setEnvs</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DsGblEnv -&gt; (IfGblEnv, IfLclEnv)
</span><a href="GHC.Tc.Types.html#ds_if_env"><span class="hs-identifier hs-var hs-var">ds_if_env</span></a></span><span> </span><span class="annot"><span class="annottext">DsGblEnv
</span><a href="#local-6989586621681140026"><span class="hs-identifier hs-var">env</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-502"></span><span>                  </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Name -&gt; TcRnIf IfGblEnv IfLclEnv TyThing
</span><a href="GHC.IfaceToCore.html#tcIfaceGlobal"><span class="hs-identifier hs-var">tcIfaceGlobal</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681140027"><span class="hs-identifier hs-var">name</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-503"></span><span>
</span><span id="line-504"></span><span class="annot"><a href="GHC.HsToCore.Monad.html#dsLookupGlobalId"><span class="hs-identifier hs-type">dsLookupGlobalId</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Name.html#Name"><span class="hs-identifier hs-type">Name</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#DsM"><span class="hs-identifier hs-type">DsM</span></a></span><span> </span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span>
</span><span id="line-505"></span><span id="dsLookupGlobalId"><span class="annot"><span class="annottext">dsLookupGlobalId :: Name -&gt; DsM Id
</span><a href="GHC.HsToCore.Monad.html#dsLookupGlobalId"><span class="hs-identifier hs-var hs-var">dsLookupGlobalId</span></a></span></span><span> </span><span id="local-6989586621681140024"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681140024"><span class="hs-identifier hs-var">name</span></a></span></span><span>
</span><span id="line-506"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HasDebugCallStack =&gt; TyThing -&gt; Id
TyThing -&gt; Id
</span><a href="GHC.Driver.Types.html#tyThingId"><span class="hs-identifier hs-var">tyThingId</span></a></span><span> </span><span class="annot"><span class="annottext">(TyThing -&gt; Id) -&gt; IOEnv (Env DsGblEnv DsLclEnv) TyThing -&gt; DsM Id
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/Data.Functor.html#%3C%24%3E"><span class="hs-operator hs-var">&lt;$&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Name -&gt; IOEnv (Env DsGblEnv DsLclEnv) TyThing
</span><a href="GHC.HsToCore.Monad.html#dsLookupGlobal"><span class="hs-identifier hs-var">dsLookupGlobal</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681140024"><span class="hs-identifier hs-var">name</span></a></span><span>
</span><span id="line-507"></span><span>
</span><span id="line-508"></span><span class="annot"><a href="GHC.HsToCore.Monad.html#dsLookupTyCon"><span class="hs-identifier hs-type">dsLookupTyCon</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Name.html#Name"><span class="hs-identifier hs-type">Name</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#DsM"><span class="hs-identifier hs-type">DsM</span></a></span><span> </span><span class="annot"><a href="GHC.Core.TyCon.html#TyCon"><span class="hs-identifier hs-type">TyCon</span></a></span><span>
</span><span id="line-509"></span><span id="dsLookupTyCon"><span class="annot"><span class="annottext">dsLookupTyCon :: Name -&gt; IOEnv (Env DsGblEnv DsLclEnv) TyCon
</span><a href="GHC.HsToCore.Monad.html#dsLookupTyCon"><span class="hs-identifier hs-var hs-var">dsLookupTyCon</span></a></span></span><span> </span><span id="local-6989586621681140022"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681140022"><span class="hs-identifier hs-var">name</span></a></span></span><span>
</span><span id="line-510"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HasDebugCallStack =&gt; TyThing -&gt; TyCon
TyThing -&gt; TyCon
</span><a href="GHC.Driver.Types.html#tyThingTyCon"><span class="hs-identifier hs-var">tyThingTyCon</span></a></span><span> </span><span class="annot"><span class="annottext">(TyThing -&gt; TyCon)
-&gt; IOEnv (Env DsGblEnv DsLclEnv) TyThing
-&gt; IOEnv (Env DsGblEnv DsLclEnv) TyCon
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/Data.Functor.html#%3C%24%3E"><span class="hs-operator hs-var">&lt;$&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Name -&gt; IOEnv (Env DsGblEnv DsLclEnv) TyThing
</span><a href="GHC.HsToCore.Monad.html#dsLookupGlobal"><span class="hs-identifier hs-var">dsLookupGlobal</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681140022"><span class="hs-identifier hs-var">name</span></a></span><span>
</span><span id="line-511"></span><span>
</span><span id="line-512"></span><span class="annot"><a href="GHC.HsToCore.Monad.html#dsLookupDataCon"><span class="hs-identifier hs-type">dsLookupDataCon</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Name.html#Name"><span class="hs-identifier hs-type">Name</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#DsM"><span class="hs-identifier hs-type">DsM</span></a></span><span> </span><span class="annot"><a href="GHC.Core.DataCon.html#DataCon"><span class="hs-identifier hs-type">DataCon</span></a></span><span>
</span><span id="line-513"></span><span id="dsLookupDataCon"><span class="annot"><span class="annottext">dsLookupDataCon :: Name -&gt; IOEnv (Env DsGblEnv DsLclEnv) DataCon
</span><a href="GHC.HsToCore.Monad.html#dsLookupDataCon"><span class="hs-identifier hs-var hs-var">dsLookupDataCon</span></a></span></span><span> </span><span id="local-6989586621681140020"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681140020"><span class="hs-identifier hs-var">name</span></a></span></span><span>
</span><span id="line-514"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HasDebugCallStack =&gt; TyThing -&gt; DataCon
TyThing -&gt; DataCon
</span><a href="GHC.Driver.Types.html#tyThingDataCon"><span class="hs-identifier hs-var">tyThingDataCon</span></a></span><span> </span><span class="annot"><span class="annottext">(TyThing -&gt; DataCon)
-&gt; IOEnv (Env DsGblEnv DsLclEnv) TyThing
-&gt; IOEnv (Env DsGblEnv DsLclEnv) DataCon
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/Data.Functor.html#%3C%24%3E"><span class="hs-operator hs-var">&lt;$&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Name -&gt; IOEnv (Env DsGblEnv DsLclEnv) TyThing
</span><a href="GHC.HsToCore.Monad.html#dsLookupGlobal"><span class="hs-identifier hs-var">dsLookupGlobal</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681140020"><span class="hs-identifier hs-var">name</span></a></span><span>
</span><span id="line-515"></span><span>
</span><span id="line-516"></span><span class="annot"><a href="GHC.HsToCore.Monad.html#dsLookupConLike"><span class="hs-identifier hs-type">dsLookupConLike</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Name.html#Name"><span class="hs-identifier hs-type">Name</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#DsM"><span class="hs-identifier hs-type">DsM</span></a></span><span> </span><span class="annot"><a href="GHC.Core.ConLike.html#ConLike"><span class="hs-identifier hs-type">ConLike</span></a></span><span>
</span><span id="line-517"></span><span id="dsLookupConLike"><span class="annot"><span class="annottext">dsLookupConLike :: Name -&gt; DsM ConLike
</span><a href="GHC.HsToCore.Monad.html#dsLookupConLike"><span class="hs-identifier hs-var hs-var">dsLookupConLike</span></a></span></span><span> </span><span id="local-6989586621681140018"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681140018"><span class="hs-identifier hs-var">name</span></a></span></span><span>
</span><span id="line-518"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HasDebugCallStack =&gt; TyThing -&gt; ConLike
TyThing -&gt; ConLike
</span><a href="GHC.Driver.Types.html#tyThingConLike"><span class="hs-identifier hs-var">tyThingConLike</span></a></span><span> </span><span class="annot"><span class="annottext">(TyThing -&gt; ConLike)
-&gt; IOEnv (Env DsGblEnv DsLclEnv) TyThing -&gt; DsM ConLike
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/Data.Functor.html#%3C%24%3E"><span class="hs-operator hs-var">&lt;$&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Name -&gt; IOEnv (Env DsGblEnv DsLclEnv) TyThing
</span><a href="GHC.HsToCore.Monad.html#dsLookupGlobal"><span class="hs-identifier hs-var">dsLookupGlobal</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681140018"><span class="hs-identifier hs-var">name</span></a></span><span>
</span><span id="line-519"></span><span>
</span><span id="line-520"></span><span>
</span><span id="line-521"></span><span class="annot"><a href="GHC.HsToCore.Monad.html#dsGetFamInstEnvs"><span class="hs-identifier hs-type">dsGetFamInstEnvs</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#DsM"><span class="hs-identifier hs-type">DsM</span></a></span><span> </span><span class="annot"><a href="GHC.Core.FamInstEnv.html#FamInstEnvs"><span class="hs-identifier hs-type">FamInstEnvs</span></a></span><span>
</span><span id="line-522"></span><span class="hs-comment">-- Gets both the external-package inst-env</span><span>
</span><span id="line-523"></span><span class="hs-comment">-- and the home-pkg inst env (includes module being compiled)</span><span>
</span><span id="line-524"></span><span id="dsGetFamInstEnvs"><span class="annot"><span class="annottext">dsGetFamInstEnvs :: DsM FamInstEnvs
</span><a href="GHC.HsToCore.Monad.html#dsGetFamInstEnvs"><span class="hs-identifier hs-var hs-var">dsGetFamInstEnvs</span></a></span></span><span>
</span><span id="line-525"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span id="local-6989586621681140016"><span class="annot"><span class="annottext">ExternalPackageState
</span><a href="#local-6989586621681140016"><span class="hs-identifier hs-var">eps</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TcRnIf DsGblEnv DsLclEnv ExternalPackageState
forall gbl lcl. TcRnIf gbl lcl ExternalPackageState
</span><a href="GHC.Tc.Utils.Monad.html#getEps"><span class="hs-identifier hs-var">getEps</span></a></span><span class="hs-special">;</span><span> </span><span id="local-6989586621681140014"><span class="annot"><span class="annottext">DsGblEnv
</span><a href="#local-6989586621681140014"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TcRnIf DsGblEnv DsLclEnv DsGblEnv
forall gbl lcl. TcRnIf gbl lcl gbl
</span><a href="GHC.Tc.Utils.Monad.html#getGblEnv"><span class="hs-identifier hs-var">getGblEnv</span></a></span><span>
</span><span id="line-526"></span><span>       </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">FamInstEnvs -&gt; DsM FamInstEnvs
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ExternalPackageState -&gt; FamInstEnv
</span><a href="GHC.Driver.Types.html#eps_fam_inst_env"><span class="hs-identifier hs-var hs-var">eps_fam_inst_env</span></a></span><span> </span><span class="annot"><span class="annottext">ExternalPackageState
</span><a href="#local-6989586621681140016"><span class="hs-identifier hs-var">eps</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">DsGblEnv -&gt; FamInstEnv
</span><a href="GHC.Tc.Types.html#ds_fam_inst_env"><span class="hs-identifier hs-var hs-var">ds_fam_inst_env</span></a></span><span> </span><span class="annot"><span class="annottext">DsGblEnv
</span><a href="#local-6989586621681140014"><span class="hs-identifier hs-var">env</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-527"></span><span>
</span><span id="line-528"></span><span class="annot"><a href="GHC.HsToCore.Monad.html#dsGetMetaEnv"><span class="hs-identifier hs-type">dsGetMetaEnv</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#DsM"><span class="hs-identifier hs-type">DsM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Name.Env.html#NameEnv"><span class="hs-identifier hs-type">NameEnv</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#DsMetaVal"><span class="hs-identifier hs-type">DsMetaVal</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-529"></span><span id="dsGetMetaEnv"><span class="annot"><span class="annottext">dsGetMetaEnv :: DsM DsMetaEnv
</span><a href="GHC.HsToCore.Monad.html#dsGetMetaEnv"><span class="hs-identifier hs-var hs-var">dsGetMetaEnv</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span id="local-6989586621681140012"><span class="annot"><span class="annottext">DsLclEnv
</span><a href="#local-6989586621681140012"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TcRnIf DsGblEnv DsLclEnv DsLclEnv
forall gbl lcl. TcRnIf gbl lcl lcl
</span><a href="GHC.Tc.Utils.Monad.html#getLclEnv"><span class="hs-identifier hs-var">getLclEnv</span></a></span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">DsMetaEnv -&gt; DsM DsMetaEnv
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DsLclEnv -&gt; DsMetaEnv
</span><a href="GHC.Tc.Types.html#dsl_meta"><span class="hs-identifier hs-var hs-var">dsl_meta</span></a></span><span> </span><span class="annot"><span class="annottext">DsLclEnv
</span><a href="#local-6989586621681140012"><span class="hs-identifier hs-var">env</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-530"></span><span>
</span><span id="line-531"></span><span class="hs-comment">-- | The @COMPLETE@ pragmas provided by the user for a given `TyCon`.</span><span>
</span><span id="line-532"></span><span class="annot"><a href="GHC.HsToCore.Monad.html#dsGetCompleteMatches"><span class="hs-identifier hs-type">dsGetCompleteMatches</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCon.html#TyCon"><span class="hs-identifier hs-type">TyCon</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#DsM"><span class="hs-identifier hs-type">DsM</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Driver.Types.html#CompleteMatch"><span class="hs-identifier hs-type">CompleteMatch</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-533"></span><span id="dsGetCompleteMatches"><span class="annot"><span class="annottext">dsGetCompleteMatches :: TyCon -&gt; DsM [CompleteMatch]
</span><a href="GHC.HsToCore.Monad.html#dsGetCompleteMatches"><span class="hs-identifier hs-var hs-var">dsGetCompleteMatches</span></a></span></span><span> </span><span id="local-6989586621681140011"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681140011"><span class="hs-identifier hs-var">tc</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-534"></span><span>  </span><span id="local-6989586621681140010"><span class="annot"><span class="annottext">ExternalPackageState
</span><a href="#local-6989586621681140010"><span class="hs-identifier hs-var">eps</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TcRnIf DsGblEnv DsLclEnv ExternalPackageState
forall gbl lcl. TcRnIf gbl lcl ExternalPackageState
</span><a href="GHC.Tc.Utils.Monad.html#getEps"><span class="hs-identifier hs-var">getEps</span></a></span><span>
</span><span id="line-535"></span><span>  </span><span id="local-6989586621681140009"><span class="annot"><span class="annottext">DsGblEnv
</span><a href="#local-6989586621681140009"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TcRnIf DsGblEnv DsLclEnv DsGblEnv
forall gbl lcl. TcRnIf gbl lcl gbl
</span><a href="GHC.Tc.Utils.Monad.html#getGblEnv"><span class="hs-identifier hs-var">getGblEnv</span></a></span><span>
</span><span id="line-536"></span><span>      </span><span class="hs-comment">-- We index into a UniqFM from Name -&gt; elt, for tyCon it holds that</span><span>
</span><span id="line-537"></span><span>      </span><span class="hs-comment">-- getUnique (tyConName tc) == getUnique tc. So we lookup using the</span><span>
</span><span id="line-538"></span><span>      </span><span class="hs-comment">-- unique directly instead.</span><span>
</span><span id="line-539"></span><span>  </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681140006"><span class="annot"><span class="annottext">lookup_completes :: UniqFM key [a] -&gt; [a]
</span><a href="#local-6989586621681140006"><span class="hs-identifier hs-var hs-var">lookup_completes</span></a></span></span><span> </span><span id="local-6989586621681140005"><span class="annot"><span class="annottext">UniqFM key [a]
</span><a href="#local-6989586621681140005"><span class="hs-identifier hs-var">ufm</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">UniqFM key [a] -&gt; [a] -&gt; Unique -&gt; [a]
forall key elt. UniqFM key elt -&gt; elt -&gt; Unique -&gt; elt
</span><a href="GHC.Types.Unique.FM.html#lookupWithDefaultUFM_Directly"><span class="hs-identifier hs-var">lookupWithDefaultUFM_Directly</span></a></span><span> </span><span class="annot"><span class="annottext">UniqFM key [a]
</span><a href="#local-6989586621681140005"><span class="hs-identifier hs-var">ufm</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TyCon -&gt; Unique
forall a. Uniquable a =&gt; a -&gt; Unique
</span><a href="GHC.Types.Unique.html#getUnique"><span class="hs-identifier hs-var">getUnique</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681140011"><span class="hs-identifier hs-var">tc</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-540"></span><span>      </span><span id="local-6989586621681140003"><span class="annot"><span class="annottext">eps_matches_list :: [CompleteMatch]
</span><a href="#local-6989586621681140003"><span class="hs-identifier hs-var hs-var">eps_matches_list</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CompleteMatchMap -&gt; [CompleteMatch]
forall {key} {a}. UniqFM key [a] -&gt; [a]
</span><a href="#local-6989586621681140006"><span class="hs-identifier hs-var">lookup_completes</span></a></span><span> </span><span class="annot"><span class="annottext">(CompleteMatchMap -&gt; [CompleteMatch])
-&gt; CompleteMatchMap -&gt; [CompleteMatch]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">ExternalPackageState -&gt; CompleteMatchMap
</span><a href="GHC.Driver.Types.html#eps_complete_matches"><span class="hs-identifier hs-var hs-var">eps_complete_matches</span></a></span><span> </span><span class="annot"><span class="annottext">ExternalPackageState
</span><a href="#local-6989586621681140010"><span class="hs-identifier hs-var">eps</span></a></span><span>
</span><span id="line-541"></span><span>      </span><span id="local-6989586621681140001"><span class="annot"><span class="annottext">env_matches_list :: [CompleteMatch]
</span><a href="#local-6989586621681140001"><span class="hs-identifier hs-var hs-var">env_matches_list</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CompleteMatchMap -&gt; [CompleteMatch]
forall {key} {a}. UniqFM key [a] -&gt; [a]
</span><a href="#local-6989586621681140006"><span class="hs-identifier hs-var">lookup_completes</span></a></span><span> </span><span class="annot"><span class="annottext">(CompleteMatchMap -&gt; [CompleteMatch])
-&gt; CompleteMatchMap -&gt; [CompleteMatch]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">DsGblEnv -&gt; CompleteMatchMap
</span><a href="GHC.Tc.Types.html#ds_complete_matches"><span class="hs-identifier hs-var hs-var">ds_complete_matches</span></a></span><span> </span><span class="annot"><span class="annottext">DsGblEnv
</span><a href="#local-6989586621681140009"><span class="hs-identifier hs-var">env</span></a></span><span>
</span><span id="line-542"></span><span>  </span><span class="annot"><span class="annottext">[CompleteMatch] -&gt; DsM [CompleteMatch]
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">([CompleteMatch] -&gt; DsM [CompleteMatch])
-&gt; [CompleteMatch] -&gt; DsM [CompleteMatch]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">[CompleteMatch]
</span><a href="#local-6989586621681140003"><span class="hs-identifier hs-var">eps_matches_list</span></a></span><span> </span><span class="annot"><span class="annottext">[CompleteMatch] -&gt; [CompleteMatch] -&gt; [CompleteMatch]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">[CompleteMatch]
</span><a href="#local-6989586621681140001"><span class="hs-identifier hs-var">env_matches_list</span></a></span><span>
</span><span id="line-543"></span><span>
</span><span id="line-544"></span><span class="annot"><a href="GHC.HsToCore.Monad.html#dsLookupMetaEnv"><span class="hs-identifier hs-type">dsLookupMetaEnv</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Name.html#Name"><span class="hs-identifier hs-type">Name</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#DsM"><span class="hs-identifier hs-type">DsM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#DsMetaVal"><span class="hs-identifier hs-type">DsMetaVal</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-545"></span><span id="dsLookupMetaEnv"><span class="annot"><span class="annottext">dsLookupMetaEnv :: Name -&gt; DsM (Maybe DsMetaVal)
</span><a href="GHC.HsToCore.Monad.html#dsLookupMetaEnv"><span class="hs-identifier hs-var hs-var">dsLookupMetaEnv</span></a></span></span><span> </span><span id="local-6989586621681140000"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681140000"><span class="hs-identifier hs-var">name</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span id="local-6989586621681139999"><span class="annot"><span class="annottext">DsLclEnv
</span><a href="#local-6989586621681139999"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TcRnIf DsGblEnv DsLclEnv DsLclEnv
forall gbl lcl. TcRnIf gbl lcl lcl
</span><a href="GHC.Tc.Utils.Monad.html#getLclEnv"><span class="hs-identifier hs-var">getLclEnv</span></a></span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">Maybe DsMetaVal -&gt; DsM (Maybe DsMetaVal)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DsMetaEnv -&gt; Name -&gt; Maybe DsMetaVal
forall a. NameEnv a -&gt; Name -&gt; Maybe a
</span><a href="GHC.Types.Name.Env.html#lookupNameEnv"><span class="hs-identifier hs-var">lookupNameEnv</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DsLclEnv -&gt; DsMetaEnv
</span><a href="GHC.Tc.Types.html#dsl_meta"><span class="hs-identifier hs-var hs-var">dsl_meta</span></a></span><span> </span><span class="annot"><span class="annottext">DsLclEnv
</span><a href="#local-6989586621681139999"><span class="hs-identifier hs-var">env</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681140000"><span class="hs-identifier hs-var">name</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-546"></span><span>
</span><span id="line-547"></span><span id="local-6989586621681140525"><span class="annot"><a href="GHC.HsToCore.Monad.html#dsExtendMetaEnv"><span class="hs-identifier hs-type">dsExtendMetaEnv</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#DsMetaEnv"><span class="hs-identifier hs-type">DsMetaEnv</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#DsM"><span class="hs-identifier hs-type">DsM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681140525"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#DsM"><span class="hs-identifier hs-type">DsM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681140525"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-548"></span><span id="dsExtendMetaEnv"><span class="annot"><span class="annottext">dsExtendMetaEnv :: forall a. DsMetaEnv -&gt; DsM a -&gt; DsM a
</span><a href="GHC.HsToCore.Monad.html#dsExtendMetaEnv"><span class="hs-identifier hs-var hs-var">dsExtendMetaEnv</span></a></span></span><span> </span><span id="local-6989586621681139997"><span class="annot"><span class="annottext">DsMetaEnv
</span><a href="#local-6989586621681139997"><span class="hs-identifier hs-var">menv</span></a></span></span><span> </span><span id="local-6989586621681139996"><span class="annot"><span class="annottext">DsM a
</span><a href="#local-6989586621681139996"><span class="hs-identifier hs-var">thing_inside</span></a></span></span><span>
</span><span id="line-549"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(DsLclEnv -&gt; DsLclEnv) -&gt; DsM a -&gt; DsM a
forall lcl gbl a.
(lcl -&gt; lcl) -&gt; TcRnIf gbl lcl a -&gt; TcRnIf gbl lcl a
</span><a href="GHC.Tc.Utils.Monad.html#updLclEnv"><span class="hs-identifier hs-var">updLclEnv</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span id="local-6989586621681139995"><span class="annot"><span class="annottext">DsLclEnv
</span><a href="#local-6989586621681139995"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">DsLclEnv
</span><a href="#local-6989586621681139995"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">dsl_meta :: DsMetaEnv
</span><a href="GHC.Tc.Types.html#dsl_meta"><span class="hs-identifier hs-var">dsl_meta</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DsLclEnv -&gt; DsMetaEnv
</span><a href="GHC.Tc.Types.html#dsl_meta"><span class="hs-identifier hs-var hs-var">dsl_meta</span></a></span><span> </span><span class="annot"><span class="annottext">DsLclEnv
</span><a href="#local-6989586621681139995"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">DsMetaEnv -&gt; DsMetaEnv -&gt; DsMetaEnv
forall a. NameEnv a -&gt; NameEnv a -&gt; NameEnv a
</span><a href="GHC.Types.Name.Env.html#plusNameEnv"><span class="hs-operator hs-var">`plusNameEnv`</span></a></span><span> </span><span class="annot"><span class="annottext">DsMetaEnv
</span><a href="#local-6989586621681139997"><span class="hs-identifier hs-var">menv</span></a></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">DsM a
</span><a href="#local-6989586621681139996"><span class="hs-identifier hs-var">thing_inside</span></a></span><span>
</span><span id="line-550"></span><span>
</span><span id="line-551"></span><span id="local-6989586621681140522"><span class="annot"><a href="GHC.HsToCore.Monad.html#discardWarningsDs"><span class="hs-identifier hs-type">discardWarningsDs</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#DsM"><span class="hs-identifier hs-type">DsM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681140522"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#DsM"><span class="hs-identifier hs-type">DsM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681140522"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-552"></span><span class="hs-comment">-- Ignore warnings inside the thing inside;</span><span>
</span><span id="line-553"></span><span class="hs-comment">-- used to ignore inaccessible cases etc. inside generated code</span><span>
</span><span id="line-554"></span><span id="discardWarningsDs"><span class="annot"><span class="annottext">discardWarningsDs :: forall a. DsM a -&gt; DsM a
</span><a href="GHC.HsToCore.Monad.html#discardWarningsDs"><span class="hs-identifier hs-var hs-var">discardWarningsDs</span></a></span></span><span> </span><span id="local-6989586621681139988"><span class="annot"><span class="annottext">DsM a
</span><a href="#local-6989586621681139988"><span class="hs-identifier hs-var">thing_inside</span></a></span></span><span>
</span><span id="line-555"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>  </span><span class="hs-special">{</span><span> </span><span id="local-6989586621681139987"><span class="annot"><span class="annottext">DsGblEnv
</span><a href="#local-6989586621681139987"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TcRnIf DsGblEnv DsLclEnv DsGblEnv
forall gbl lcl. TcRnIf gbl lcl gbl
</span><a href="GHC.Tc.Utils.Monad.html#getGblEnv"><span class="hs-identifier hs-var">getGblEnv</span></a></span><span>
</span><span id="line-556"></span><span>        </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681139986"><span class="annot"><span class="annottext">Messages
</span><a href="#local-6989586621681139986"><span class="hs-identifier hs-var">old_msgs</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TcRef Messages -&gt; IOEnv (Env DsGblEnv DsLclEnv) Messages
forall a gbl lcl. TcRef a -&gt; TcRnIf gbl lcl a
</span><a href="GHC.Tc.Utils.Monad.html#readTcRef"><span class="hs-identifier hs-var">readTcRef</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DsGblEnv -&gt; TcRef Messages
</span><a href="GHC.Tc.Types.html#ds_msgs"><span class="hs-identifier hs-var hs-var">ds_msgs</span></a></span><span> </span><span class="annot"><span class="annottext">DsGblEnv
</span><a href="#local-6989586621681139987"><span class="hs-identifier hs-var">env</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-557"></span><span>
</span><span id="line-558"></span><span>        </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681139984"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621681139984"><span class="hs-identifier hs-var">result</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">DsM a
</span><a href="#local-6989586621681139988"><span class="hs-identifier hs-var">thing_inside</span></a></span><span>
</span><span id="line-559"></span><span>
</span><span id="line-560"></span><span>        </span><span class="hs-comment">-- Revert messages to old_msgs</span><span>
</span><span id="line-561"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">TcRef Messages -&gt; Messages -&gt; DsM ()
forall a gbl lcl. TcRef a -&gt; a -&gt; TcRnIf gbl lcl ()
</span><a href="GHC.Tc.Utils.Monad.html#writeTcRef"><span class="hs-identifier hs-var">writeTcRef</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DsGblEnv -&gt; TcRef Messages
</span><a href="GHC.Tc.Types.html#ds_msgs"><span class="hs-identifier hs-var hs-var">ds_msgs</span></a></span><span> </span><span class="annot"><span class="annottext">DsGblEnv
</span><a href="#local-6989586621681139987"><span class="hs-identifier hs-var">env</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Messages
</span><a href="#local-6989586621681139986"><span class="hs-identifier hs-var">old_msgs</span></a></span><span>
</span><span id="line-562"></span><span>
</span><span id="line-563"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">a -&gt; DsM a
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621681139984"><span class="hs-identifier hs-var">result</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-564"></span><span>
</span><span id="line-565"></span><span class="hs-comment">-- | Fail with an error message if the type is levity polymorphic.</span><span>
</span><span id="line-566"></span><span class="annot"><a href="GHC.HsToCore.Monad.html#dsNoLevPoly"><span class="hs-identifier hs-type">dsNoLevPoly</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#SDoc"><span class="hs-identifier hs-type">SDoc</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#DsM"><span class="hs-identifier hs-type">DsM</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-567"></span><span class="hs-comment">-- See Note [Levity polymorphism checking]</span><span>
</span><span id="line-568"></span><span id="dsNoLevPoly"><span class="annot"><span class="annottext">dsNoLevPoly :: Type -&gt; SDoc -&gt; DsM ()
</span><a href="GHC.HsToCore.Monad.html#dsNoLevPoly"><span class="hs-identifier hs-var hs-var">dsNoLevPoly</span></a></span></span><span> </span><span id="local-6989586621681139982"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681139982"><span class="hs-identifier hs-var">ty</span></a></span></span><span> </span><span id="local-6989586621681139981"><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621681139981"><span class="hs-identifier hs-var">doc</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(SDoc -&gt; DsM ()) -&gt; SDoc -&gt; Type -&gt; DsM ()
forall (m :: * -&gt; *).
Monad m =&gt;
(SDoc -&gt; m ()) -&gt; SDoc -&gt; Type -&gt; m ()
</span><a href="GHC.Tc.Utils.TcMType.html#checkForLevPolyX"><span class="hs-identifier hs-var">checkForLevPolyX</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; DsM ()
forall a. SDoc -&gt; DsM a
</span><a href="GHC.HsToCore.Monad.html#failWithDs"><span class="hs-identifier hs-var">failWithDs</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621681139981"><span class="hs-identifier hs-var">doc</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681139982"><span class="hs-identifier hs-var">ty</span></a></span><span>
</span><span id="line-569"></span><span>
</span><span id="line-570"></span><span class="hs-comment">-- | Check an expression for levity polymorphism, failing if it is</span><span>
</span><span id="line-571"></span><span class="hs-comment">-- levity polymorphic.</span><span>
</span><span id="line-572"></span><span class="annot"><a href="GHC.HsToCore.Monad.html#dsNoLevPolyExpr"><span class="hs-identifier hs-type">dsNoLevPolyExpr</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.html#CoreExpr"><span class="hs-identifier hs-type">CoreExpr</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#SDoc"><span class="hs-identifier hs-type">SDoc</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#DsM"><span class="hs-identifier hs-type">DsM</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-573"></span><span class="hs-comment">-- See Note [Levity polymorphism checking]</span><span>
</span><span id="line-574"></span><span id="dsNoLevPolyExpr"><span class="annot"><span class="annottext">dsNoLevPolyExpr :: CoreExpr -&gt; SDoc -&gt; DsM ()
</span><a href="GHC.HsToCore.Monad.html#dsNoLevPolyExpr"><span class="hs-identifier hs-var hs-var">dsNoLevPolyExpr</span></a></span></span><span> </span><span id="local-6989586621681139980"><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681139980"><span class="hs-identifier hs-var">e</span></a></span></span><span> </span><span id="local-6989586621681139979"><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621681139979"><span class="hs-identifier hs-var">doc</span></a></span></span><span>
</span><span id="line-575"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">CoreExpr -&gt; Bool
</span><a href="GHC.Core.Utils.html#isExprLevPoly"><span class="hs-identifier hs-var">isExprLevPoly</span></a></span><span> </span><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681139980"><span class="hs-identifier hs-var">e</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; DsM ()
</span><a href="GHC.HsToCore.Monad.html#errDs"><span class="hs-identifier hs-var">errDs</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Type -&gt; SDoc
</span><a href="GHC.Tc.Utils.TcMType.html#formatLevPolyErr"><span class="hs-identifier hs-var">formatLevPolyErr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CoreExpr -&gt; Type
</span><a href="GHC.Core.Utils.html#exprType"><span class="hs-identifier hs-var">exprType</span></a></span><span> </span><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681139980"><span class="hs-identifier hs-var">e</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%24%24"><span class="hs-operator hs-var">$$</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621681139979"><span class="hs-identifier hs-var">doc</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-576"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">() -&gt; DsM ()
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-577"></span><span>
</span><span id="line-578"></span><span class="hs-comment">-- | Runs the thing_inside. If there are no errors, then returns the expr</span><span>
</span><span id="line-579"></span><span class="hs-comment">-- given. Otherwise, returns unitExpr. This is useful for doing a bunch</span><span>
</span><span id="line-580"></span><span class="hs-comment">-- of levity polymorphism checks and then avoiding making a core App.</span><span>
</span><span id="line-581"></span><span class="hs-comment">-- (If we make a core App on a levity polymorphic argument, detecting how</span><span>
</span><span id="line-582"></span><span class="hs-comment">-- to handle the let/app invariant might call isUnliftedType, which panics</span><span>
</span><span id="line-583"></span><span class="hs-comment">-- on a levity polymorphic type.)</span><span>
</span><span id="line-584"></span><span class="hs-comment">-- See #12709 for an example of why this machinery is necessary.</span><span>
</span><span id="line-585"></span><span id="local-6989586621681140513"><span class="annot"><a href="GHC.HsToCore.Monad.html#dsWhenNoErrs"><span class="hs-identifier hs-type">dsWhenNoErrs</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#DsM"><span class="hs-identifier hs-type">DsM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681140513"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621681140513"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.html#CoreExpr"><span class="hs-identifier hs-type">CoreExpr</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#DsM"><span class="hs-identifier hs-type">DsM</span></a></span><span> </span><span class="annot"><a href="GHC.Core.html#CoreExpr"><span class="hs-identifier hs-type">CoreExpr</span></a></span></span><span>
</span><span id="line-586"></span><span id="dsWhenNoErrs"><span class="annot"><span class="annottext">dsWhenNoErrs :: forall a. DsM a -&gt; (a -&gt; CoreExpr) -&gt; DsM CoreExpr
</span><a href="GHC.HsToCore.Monad.html#dsWhenNoErrs"><span class="hs-identifier hs-var hs-var">dsWhenNoErrs</span></a></span></span><span> </span><span id="local-6989586621681139975"><span class="annot"><span class="annottext">DsM a
</span><a href="#local-6989586621681139975"><span class="hs-identifier hs-var">thing_inside</span></a></span></span><span> </span><span id="local-6989586621681139974"><span class="annot"><span class="annottext">a -&gt; CoreExpr
</span><a href="#local-6989586621681139974"><span class="hs-identifier hs-var">mk_expr</span></a></span></span><span>
</span><span id="line-587"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681139973"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621681139973"><span class="hs-identifier hs-var">result</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681139972"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681139972"><span class="hs-identifier hs-var">no_errs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">DsM a -&gt; DsM (a, Bool)
forall a. DsM a -&gt; DsM (a, Bool)
</span><a href="GHC.HsToCore.Monad.html#askNoErrsDs"><span class="hs-identifier hs-var">askNoErrsDs</span></a></span><span> </span><span class="annot"><span class="annottext">DsM a
</span><a href="#local-6989586621681139975"><span class="hs-identifier hs-var">thing_inside</span></a></span><span>
</span><span id="line-588"></span><span>       </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">CoreExpr -&gt; DsM CoreExpr
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">(CoreExpr -&gt; DsM CoreExpr) -&gt; CoreExpr -&gt; DsM CoreExpr
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681139972"><span class="hs-identifier hs-var">no_errs</span></a></span><span>
</span><span id="line-589"></span><span>                  </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">a -&gt; CoreExpr
</span><a href="#local-6989586621681139974"><span class="hs-identifier hs-var">mk_expr</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621681139973"><span class="hs-identifier hs-var">result</span></a></span><span>
</span><span id="line-590"></span><span>                  </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">CoreExpr
</span><a href="GHC.Core.Make.html#unitExpr"><span class="hs-identifier hs-var">unitExpr</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-591"></span><span>
</span><span id="line-592"></span><span class="hs-comment">-- | Inject a trace message into the compiled program. Whereas</span><span>
</span><span id="line-593"></span><span class="hs-comment">-- pprTrace prints out information *while compiling*, pprRuntimeTrace</span><span>
</span><span id="line-594"></span><span class="hs-comment">-- captures that information and causes it to be printed *at runtime*</span><span>
</span><span id="line-595"></span><span class="hs-comment">-- using Debug.Trace.trace.</span><span>
</span><span id="line-596"></span><span class="hs-comment">--</span><span>
</span><span id="line-597"></span><span class="hs-comment">--   pprRuntimeTrace hdr doc expr</span><span>
</span><span id="line-598"></span><span class="hs-comment">--</span><span>
</span><span id="line-599"></span><span class="hs-comment">-- will produce an expression that looks like</span><span>
</span><span id="line-600"></span><span class="hs-comment">--</span><span>
</span><span id="line-601"></span><span class="hs-comment">--   trace (hdr + doc) expr</span><span>
</span><span id="line-602"></span><span class="hs-comment">--</span><span>
</span><span id="line-603"></span><span class="hs-comment">-- When using this to debug a module that Debug.Trace depends on,</span><span>
</span><span id="line-604"></span><span class="hs-comment">-- it is necessary to import {-# SOURCE #-} Debug.Trace () in that</span><span>
</span><span id="line-605"></span><span class="hs-comment">-- module. We could avoid this inconvenience by wiring in Debug.Trace.trace,</span><span>
</span><span id="line-606"></span><span class="hs-comment">-- but that doesn't seem worth the effort and maintenance cost.</span><span>
</span><span id="line-607"></span><span class="annot"><a href="GHC.HsToCore.Monad.html#pprRuntimeTrace"><span class="hs-identifier hs-type">pprRuntimeTrace</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span>   </span><span class="hs-comment">-- ^ header</span><span>
</span><span id="line-608"></span><span>                </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#SDoc"><span class="hs-identifier hs-type">SDoc</span></a></span><span>     </span><span class="hs-comment">-- ^ information to output</span><span>
</span><span id="line-609"></span><span>                </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.html#CoreExpr"><span class="hs-identifier hs-type">CoreExpr</span></a></span><span> </span><span class="hs-comment">-- ^ expression</span><span>
</span><span id="line-610"></span><span>                </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#DsM"><span class="hs-identifier hs-type">DsM</span></a></span><span> </span><span class="annot"><a href="GHC.Core.html#CoreExpr"><span class="hs-identifier hs-type">CoreExpr</span></a></span><span>
</span><span id="line-611"></span><span id="pprRuntimeTrace"><span class="annot"><span class="annottext">pprRuntimeTrace :: String -&gt; SDoc -&gt; CoreExpr -&gt; DsM CoreExpr
</span><a href="GHC.HsToCore.Monad.html#pprRuntimeTrace"><span class="hs-identifier hs-var hs-var">pprRuntimeTrace</span></a></span></span><span> </span><span id="local-6989586621681139971"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681139971"><span class="hs-identifier hs-var">str</span></a></span></span><span> </span><span id="local-6989586621681139970"><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621681139970"><span class="hs-identifier hs-var">doc</span></a></span></span><span> </span><span id="local-6989586621681139969"><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681139969"><span class="hs-identifier hs-var">expr</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-612"></span><span>  </span><span id="local-6989586621681139968"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681139968"><span class="hs-identifier hs-var">traceId</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Name -&gt; DsM Id
</span><a href="GHC.HsToCore.Monad.html#dsLookupGlobalId"><span class="hs-identifier hs-var">dsLookupGlobalId</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="GHC.Builtin.Names.html#traceName"><span class="hs-identifier hs-var">traceName</span></a></span><span>
</span><span id="line-613"></span><span>  </span><span id="local-6989586621681139966"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681139966"><span class="hs-identifier hs-var">unpackCStringId</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Name -&gt; DsM Id
</span><a href="GHC.HsToCore.Monad.html#dsLookupGlobalId"><span class="hs-identifier hs-var">dsLookupGlobalId</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="GHC.Builtin.Names.html#unpackCStringName"><span class="hs-identifier hs-var">unpackCStringName</span></a></span><span>
</span><span id="line-614"></span><span>  </span><span id="local-6989586621681139964"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681139964"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">IOEnv (Env DsGblEnv DsLclEnv) DynFlags
forall (m :: * -&gt; *). HasDynFlags m =&gt; m DynFlags
</span><a href="GHC.Driver.Session.html#getDynFlags"><span class="hs-identifier hs-var">getDynFlags</span></a></span><span>
</span><span id="line-615"></span><span>  </span><span class="hs-keyword">let</span><span> </span><span class="annot"><a href="#local-6989586621681139963"><span class="hs-identifier hs-type">message</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.html#CoreExpr"><span class="hs-identifier hs-type">CoreExpr</span></a></span><span>
</span><span id="line-616"></span><span>      </span><span id="local-6989586621681139963"><span class="annot"><span class="annottext">message :: CoreExpr
</span><a href="#local-6989586621681139963"><span class="hs-identifier hs-var hs-var">message</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CoreExpr -&gt; DsWrapper
forall b. Expr b -&gt; Expr b -&gt; Expr b
</span><a href="GHC.Core.html#App"><span class="hs-identifier hs-var">App</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Id -&gt; CoreExpr
forall b. Id -&gt; Expr b
</span><a href="GHC.Core.html#Var"><span class="hs-identifier hs-var">Var</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681139966"><span class="hs-identifier hs-var">unpackCStringId</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">DsWrapper -&gt; DsWrapper
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-617"></span><span>                </span><span class="annot"><span class="annottext">Literal -&gt; CoreExpr
forall b. Literal -&gt; Expr b
</span><a href="GHC.Core.html#Lit"><span class="hs-identifier hs-var">Lit</span></a></span><span> </span><span class="annot"><span class="annottext">(Literal -&gt; CoreExpr) -&gt; Literal -&gt; CoreExpr
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; Literal
</span><a href="GHC.Types.Literal.html#mkLitString"><span class="hs-identifier hs-var">mkLitString</span></a></span><span> </span><span class="annot"><span class="annottext">(String -&gt; Literal) -&gt; String -&gt; Literal
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; SDoc -&gt; String
</span><a href="GHC.Utils.Outputable.html#showSDoc"><span class="hs-identifier hs-var">showSDoc</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681139964"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SDoc -&gt; Int -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#hang"><span class="hs-identifier hs-var">hang</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681139971"><span class="hs-identifier hs-var">str</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">4</span></span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621681139970"><span class="hs-identifier hs-var">doc</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-618"></span><span>  </span><span class="annot"><span class="annottext">CoreExpr -&gt; DsM CoreExpr
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">(CoreExpr -&gt; DsM CoreExpr) -&gt; CoreExpr -&gt; DsM CoreExpr
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">CoreExpr -&gt; [CoreExpr] -&gt; CoreExpr
forall b. Expr b -&gt; [Expr b] -&gt; Expr b
</span><a href="GHC.Core.html#mkApps"><span class="hs-identifier hs-var">mkApps</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Id -&gt; CoreExpr
forall b. Id -&gt; Expr b
</span><a href="GHC.Core.html#Var"><span class="hs-identifier hs-var">Var</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681139968"><span class="hs-identifier hs-var">traceId</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Type -&gt; CoreExpr
forall b. Type -&gt; Expr b
</span><a href="GHC.Core.html#Type"><span class="hs-identifier hs-var">Type</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CoreExpr -&gt; Type
</span><a href="GHC.Core.Utils.html#exprType"><span class="hs-identifier hs-var">exprType</span></a></span><span> </span><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681139969"><span class="hs-identifier hs-var">expr</span></a></span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681139963"><span class="hs-identifier hs-var">message</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681139969"><span class="hs-identifier hs-var">expr</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-619"></span></pre></body></html>